Align a div to center

There is no float to center per se. If you want to center a block element inside another do this:

<div id="outer">
  <div id="inner">Stuff to center</div>
</div>

with:

#outer { width: 600px; }
#inner { width: 250px; margin: 0 auto; }

Now that won’t make the text wrap around it (like it would with a float left or right) but like I said: there is no float center.

Leave a Comment