How can I vertically center a "div" element for all browsers using CSS?
Asked 07 September, 2021
Viewed 2.8K times
  • 64
Votes

I want to center a div vertically with CSS. I don't want tables or JavaScript, but only pure CSS. I found some solutions, but all of them are missing Internet Explorer 6 support.

<body>
    <div>Div to be aligned vertically</div>
</body>

How can I center a div vertically in all major browsers, including Internet Explorer 6?

30 Answer