Uncategorized
June 12, 2025

How To Center a Div

Thumbnail image of blog: How To Center a Div

For a long time, centering an element within its parent was a surprisingly tricky thing to do. As CSS has evolved, we've been granted more and more tools we can use to solve this problem. These days, we're spoiled for choice!

I decided to create this tutorial to help you understand the trade-offs between different approaches, and to give you an arsenal of strategies you can use, to handle centering in all sorts of scenarios.

Honestly, this turned out to be way more interesting than I initially thought 😅. Even if you've been using CSS for a while, I bet you'll learn at least 1 new strategy!

export const blogEditSchema = blogCreateSchema.extend({
  subtitle: z.string().trim().optional().nullable(),
  content: z.string().optional().nullable(),
  categoryId: z.string().optional().nullable(),
  thumbnailImageId: z.string().trim().optional().nullable(),
  isPublished: z.boolean().default(false),
});

Comments:

Share article:

Last updated:

June 12, 2025

Written by

Hammad Javed

Your unordinary web developer 👨‍💻

More posts
Profile picture of author Hammad Javed