Bin Chen Bin Chen - 1 month ago 8
HTML Question

html: how to make all the DIVs in the center of the page?

like:

<body>
<div></div>
<div></div>
</body>


How can I make all the DIVs at the center of the webpage?

I mean in the browser.

Answer

HTML:

<div class="center"></div>

CSS:

div.center { margin: 0 auto; }

Of course, if you have other things outside of those divs, they might interfere.