Internet Explorer and margins

Posted by Hailwood on Pro Webmasters See other posts from Pro Webmasters or by Hailwood
Published on 2011-01-31T23:30:20Z Indexed on 2011/01/31 23:34 UTC
Read the original article Hit count: 336

Filed under:
|
|

Hi there.

I have some pretty simple html which is meant to make a layout as below.

To push the tabs down from the userbar I am using
margin-top: 35px;
However in internet explorer the tabs are completly misaligned(the top of the tabs is where the bottom should be).

So I need to use margin-top: -50px; for internet explorer.

Why is this and how can I fix it without using a ie specific stylesheet

layout example

<div id="pageHead">
  <div id="userBar">
    <span class="bold">Hi Matthew Hailwood | <a href="#">Logout</a>
  </div>
  <a href="http://localhost/buzz/" id="pageLogo"></a>  
  <div id="pageTabs" class="clearfix">
    <ul>
      <li><a href="http://localhost/buzzil/templates">Templates</a></li>
      <li><a href="http://localhost/buzzil/messaging">Messaging</a></li>
      <li><a href="http://localhost/buzzil/contacts">Contacts</a></li>
    </ul>
  </div>
</div>

With the css being

#pageHead {
    height: 100px;
}

#pageLogo {
    float: left;
    width: 149px;
    height: 77px;
    margin-top: 11px;
    background: transparent url('../images/logo.png') no-repeat;
}

#userBar {
    text-align: right;
    color: #fff;
    margin-top: 10px;
}

#userBar a:link,
#userBar a:visited,
#userBar a:active {
    font-weight: normal;
    color: #E0B343;
    text-decoration: none;
}

.clearfix:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.clearfix {
    display: inline-block;
}

html[xmlns] .clearfix {
    display: block;
}

* html .clearfix {
    height: 1%;
}

#pageTabs {
    float: right;
    margin-top: 35px;
}

#pageTabs ul {
    position: relative;
    width: 100%;
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 1px solid #000;
}

#pageTabs ul li {
    float: right;
    background: url(../images/tabsBg.png) no-repeat 0% 0%;
    border-left: 1px solid #000;
    margin-left: -1px;
}

#pageTabs ul li a:link,
#pageTabs ul li a:visited,
#pageTabs ul li a:active {
    color: #fff;
    background: url(../images/tabsBg.png) no-repeat 100% 0%;
    display: block;
    font-size: 14px;
    font-weight: bold;
    line-height: 42px;
    text-transform: uppercase;
    padding: 4px 32px;
    text-decoration: none;
}

#pageTabs ul li a:hover,
#pageTabs ul li a:focus {
    text-decoration: underline;
}

© Pro Webmasters or respective owner

Related posts about html

Related posts about css