IE and the CSS margin-top tag

Oh, the joy of web design. Chrome was behaving as it should, but Internet Explorer 11 wasn’t. I had a header div element on my body, but the background from the main page was showing above the header. I was using a negative margin along the top, like so:

 margin-top: -10px;

What worked for me was modify the units for the margin-top statement to “vh” instead of “px”:

 margin-top: -1.4vh;

This did throw off the Chrome alignment slightly, and it wasn’t exactly vertically centered as it was before, but it was pretty close, and I was happy enough with the result to not throw things at the screen.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: