Blog

How to center a div without specifying width

Posted by : Leo T Abraham on 13 August, 2013

We can center a div without specifying width by using the following steps:

1) Put a wrapper div to the div which you are about to make centered.

2) Give the style text-align :center to the wrapper div.

3) Give the style  display: inline-block to the div you are looking to make centered.