Home › Forums › CSS › How to center elements in DIVs (four separate DIVs)? › Re: How to center elements in DIVs (four separate DIVs)?
September 22, 2012 at 9:57 am
#110574
Member
If the content of your h1 is just text, you should be able to just add the `text-align: center` to the h1 directly. Then you wouldn’t have to reset the rest of the div’s contents.
An h1 is `display: block` by default, so it should fill the width of its container. And this will center the text.
If your h1 is an image replacement, give it a fixed width with left and right margins `auto`.
Either way you wouldn’t need to set the display as `inline-block`.