user3806674
user3806674

Reputation: 17

How to center horizontal/vertical in IE?

Here's the page I'm working on:

http://www.escalateinternet.com/

I'm trying to center the login form both vertically and horizontally. It's working in all browsers right now except for Internet Explorer.

Here's the CSS I added to the div to center it:

bottom: 0;
height: 400px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;

What am I doing wrong for it to not be centered in IE like it is in other browsers?

Upvotes: 1

Views: 382

Answers (4)

Amit
Amit

Reputation: 1919

try this

element.style {
    bottom: 0;
    height: 400px;
    left: 50%;
    margin: auto auto auto -150px;
    position: absolute;
    top: 0;
}

Upvotes: 0

Raman jaswal
Raman jaswal

Reputation: 97

bottom: 0;
height: 400px;
left: 0;
margin: auto;
position: absolute;
right: 0;
top: 0;
text-align:center;

Upvotes: 2

Rahiil
Rahiil

Reputation: 110

Because you do not have DOCTYPE declairation, this error occured. add this line above html tag. At the top of document.
<!DOCTYPE html>

Upvotes: 0

Enethion
Enethion

Reputation: 1257

On div with those classes: whmcscontainer contentpadded put css width:100%. IE needs parent's width for reference to set position with margin: auto.

Upvotes: 0

Related Questions