DEV Community

sourov khan
sourov khan

Posted on

How to Center a Div with CSS - 6 simple ways

To develop and personalize your layouts, you'll need a basic knowledge of HTML and CSS, whether you're constructing a site from scratch or using the Bootstrap CSS framework.

Arranging and styling components on the page is a significant difficulty when creating layouts.

How to center a div?

Do you want the pieces to overlap or be separated?

Do you want the layout to be mobile-friendly?

Do you want to center Div on the page?

Here 6 simple way to center a div:

1.Using Flexbox

flexbox

2.Using Grid

grid

3.Using Position

position

4.Using Position & Calc

position & calc

5.Using Flex & margin

flex & margin

6.Using Grid & Margin

grid & margin

For more information like that please follow on social links:

Facebook
Instagram
Twitter

Top comments (0)