0

I have a navigation menu (CSS-only, structured as a list) which works fine on Firefox, Opera and Chrome on a Windows machine. Can't test Safari right now, but I have a problem with the last element of the list not fitting into the given width (which is fixed at 1000px) on Internet Explorer and Chrome on MAC (note that it works fine on Windows Chrome). Both Chromes are (close to) the latest version so that can't be the issue.

Now, if the problem was IE-only, I'd just make a conditional stylesheet and be done with it. But the Chrome thing is bugging me. So here are the screenshots of the working version (taken on Firefox) and the broken version (taken on IE):

ok not ok

This is the HTML and CSS code of the navigation menu, if you think there's any other relevant CSS please let me know. It seems to me like the text is causing the problem. I've tried fiddling with the font weight, font family and space between letters, but nothing seems to remedy the issue.

<div id="rn-holder">
    <nav id="rolling-nav">
        <ul>
            <li><a href="http://www.domain.com/en/index.php" data-clone="Home">Home</a></li>
            <li class='has-sub '><a href="http://www.domain.com/en/my-team" data-clone="My Team">My Team</a>
              <ul>
                    <li><a href="http://www.domain.com/en/my-team" >Team Settings</a></li>
                                <li><a href="http://www.domain.com/en/account-settings" >Account Settings</a></li>
                              </ul>
        </li>
            <li><a href="http://www.domain.com/en/transfer-center" data-clone="Transfer Center">Transfer Center</a></li>
            <li class='has-sub '><a href="http://www.domain.com/en/browse-leagues" data-clone="Leagues">Leagues</a>
              <ul>
                    <li><a href="http://www.domain.com/en/browse-leagues" >Browse Leagues</a></li>
                <li><a href="http://www.domain.com/en/my-leagues" >My Leagues</a></li>
              </ul>
        </li>
            <li><a href="http://www.domain.com/en/rules-of-the-game" data-clone="Rules">Rules</a></li>
        <li class='has-sub '><a href="http://www.domain.com/en/statistics/players" data-clone="Stats">Stats</a>
              <ul>
                    <li><a href="http://www.domain.com/en/statistics/players" >Player Stats</a></li>
                <li><a href="http://www.domain.com/en/statistics/teams" >Team Stats</a></li>
                <li><a href="http://www.domain.com/en/statistics/members" >Member Stats</a></li>
                <li><a href="http://www.domain.com/en/statistics/clubs" >Club Stats</a></li>
                                <li><a href="http://www.domain.com/en/serie-a-standings-table" >Standings</a></li>
                <li><a href="http://www.domain.com/en/match-center/20/0" >Match Center</a></li>
                <li><a href="http://www.domain.com/en/player-injuries-and-suspensions" >Injury Report</a></li>
              </ul>
        </li>
            <li class='has-sub '><a href="http://www.domain.com/en/season-dream-team/2012-13" data-clone="Dream Team">Dream Team</a>
              <ul>
                    <li><a href="http://www.domain.com/en/season-dream-team/2012-13" >Season Dream Team</a></li>
                    <li><a href='http://www.domain.com/en/round-dream-team/20' >Round 20 Dream Team</a></li><li><a href='http://www.domain.com/en/round-dream-team/19' >Round 19 Dream Team</a></li><li><a href='http://www.domain.com/en/round-dream-team/18' >Round 18 Dream Team</a></li><li><a href='http://www.domain.com/en/round-dream-team/17' >Round 17 Dream Team</a></li><li><a href='http://www.domain.com/en/round-dream-team/16' >Round 16 Dream Team</a></li>              </ul>
        </li>
            <li class='has-sub '><a href="http://www.domain.com/en/choose-account-type" data-clone="Upgrade">Upgrade</a>
              <ul>
                    <li><a href="http://www.domain.com/en/choose-account-type" >Choose Account</a></li>
                <li><a href="http://www.domain.com/en/premium-accounts" >Account Types</a></li>
                <li><a class="getcoins" >Get Coins</a></li>
                <li><a href="http://www.domain.com/en/store" >Store</a></li>
              </ul>
        </li>
            <li class='has-sub '><a href="http://www.domain.com/en/about-us" data-clone="About">About</a>
              <ul>
                    <li><a href="http://www.domain.com/en/about-us" >About Us</a></li>
                <li><a href="http://www.domain.com/en/contact-us" >Contact Us</a></li>
                <li><a href="http://www.domain.com/en/terms-and-conditions" >Terms & Conditions</a></li>
              </ul>
        </li>
        </ul>
    </nav>
</div>

So that's the HTML (there are, as you see, dropdown menus, but their presence or absence doesn't effect the problem). Here are the styles (including dropdown list styles, probably irrelevant to this problem but can't hurt to share them):

#rn-holder{
    width:1000px;
    margin:10px 0;
    background-color:#ca1026;
    background-image:-webkit-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-moz-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-ms-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-o-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    -webkit-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    -moz-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    -webkit-transition:all 0.3s ease-in-out;
    -moz-transition:all 0.3s ease-in-out;
    -ms-transition:all 0.3s ease-in-out;
    -o-transition:all 0.3s ease-in-out;
    transition:all 0.3s ease-in-out;
    font-weight:normal;
}

#rolling-nav {
    color:white;
    text-transform:uppercase;
    position:relative;
    font-size:12px;
    margin-left:2px;
}

#rolling-nav ul {
    height:50px;
    margin:0px 0px;
    padding:0px 0px;
    overflow:hidden;
}

#rolling-nav li {
    float:left;
    list-style:none;
    margin:0px 0px;
    padding:0px 0px;
}

#rolling-nav li:hover > a {
    margin-top:-50px;
    margin-bottom:1px;
}

*html #rolling-nav li a:hover{ /* IE6 */
    margin-top:-50px;
    margin-bottom:1px;
}

#rolling-nav a,
#rolling-nav a:before {
    display:block;
    margin:0px 0px;
    padding:0px 27px;
    line-height:50px;
    color:white;
    text-decoration:none;
    background-color:#ca1026;
    background-image:-webkit-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-moz-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-ms-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:-o-linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    background-image:linear-gradient(top, #ca1026 0%, #b60c12 33%, #9b0c12 67%, #810a0f 100%);
    -webkit-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    -moz-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
    position:relative;
    -webkit-transition:all 0.3s ease-in-out;
    -moz-transition:all 0.3s ease-in-out;
    -ms-transition:all 0.3s ease-in-out;
    -o-transition:all 0.3s ease-in-out;
    transition:all 0.3s ease-in-out;
    font-weight:normal;
}

#rolling-nav a:before {
    content:attr(data-clone);
    position:absolute;
    top:100%;
    left:0px;
    display:block;
    background-color:white;
    background-image:-webkit-linear-gradient(top, #ddd, white);
    background-image:-moz-linear-gradient(top, #ddd, white);
    background-image:-ms-linear-gradient(top, #ddd, white);
    background-image:-o-linear-gradient(top, #ddd, white);
    background-image:linear-gradient(top, #ddd, white);
    border-top:2px solid rgba(0,0,0,0.2);
    color:#333;
}

#rolling-nav a:hover {
    margin-top:-50px;
    margin-bottom:1px;
}

/*For dropdown sub Menu*/
#rolling-nav .has-sub:hover ul {
    display:block;
    list-style:none;
}

#rolling-nav .has-sub.hover ul {
    display:block;
    list-style:none;
}

#rolling-nav .has-sub ul {
    display:block;
    display: none;  
    position: absolute;
    height:auto;
    top: 50px;
    float:left;
    text-align: center;
    width:160px;
}

#rolling-nav .has-sub ul li {
    text-align: center;
    display:block;
    float:left;
    list-style:none;
    margin-top:0px;
    margin-bottom:0px;
    width:150px;
}

#rolling-nav .has-sub ul li a {
    border-top: 0 none;
    border-left: 1px solid #d2d2d2;
    font-size:12px;
    display:block;
    padding: 1px 1px;
    text-align: center;
    margin-top:0px;
    margin-bottom:0px;
    z-index:45;
    line-height:40px;
}

#rolling-nav .has-sub ul li span.premium {
    background: url('../images/star_yellow_small.png') no-repeat;
    float:left;
    height:9px;
    width:9px;
    position:relative;
    top:15px;
    left:8px;
}

#rolling-nav .has-sub ul li a:hover {
    background-color:#666666;
    background-image:-webkit-linear-gradient(top, #ddd, #666666);
    background-image:-moz-linear-gradient(top, #ddd, #666666);
    background-image:-ms-linear-gradient(top, #ddd, #666666);
    background-image:-o-linear-gradient(top, #ddd, #666666);
    background-image:linear-gradient(top, #ddd, #666666);
    color:white;
}

*{
    font-family:Arial, Helvetica, sans-serif;
}

Does anyone see what the problem is? I don't mind if the fix doesn't work on IE, but I need it to work on all "normal" browsers, such as Chrome on MAC.

sveti petar
  • 3,637
  • 13
  • 67
  • 144
  • I cannot test Chrome on MAC myself but I seem to remember running into an issue like this in the past but I think it was with IE. Try remove the `white space` between all your elements. You can do it like this `
  • ` or to preserve new lines do this `
  • `. By no means do I prefer the solution but it's worth a try. I know something similar happens with `img` tags and white space also.
  • – hungerstar Jul 03 '13 at 18:42
  • I suggest you look into [kerning](http://stackoverflow.com/questions/5512169/ie9-letter-spacing-problem). I don't know about Mac Chrome but I do know that IE uses a technology called Cleartype. For example, "MY TEAM" is about 52px long in IE and 48px in Chrome for me (zoom changes this as well). – MiniRagnarok Jul 03 '13 at 19:01