Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why wont this work in Internet Explorer?

I'm trying to have this nav bar using <ul> and <li> and some css so that it makes a horizontal navigation but the way I have it, it doesn't work in IE, only Firefox and Chrome. Anyone know why?

Here is the CSS:

.navbar1 ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;

}
.navbar1 li {
    float: left;
}
.navbar1 a {
    font-size: 24px;
    color: #FC0;
    background-color: #900;
    float: right;
    text-align: center;
    height: 30px;
    width: 120px;
    border-top-width: 5px;
    border-bottom-width: 5px;
    border-top-style: solid;
    border-bottom-style: solid;
    border-top-color: #FC0;
    border-right-color: #FC0;
    border-bottom-color: #FC0;
    border-left-color: #FC0;
    font-family: "Britannic Bold";  
}
.navbar1 a:hover, a:active {
    background-color:#500
}

Here is the HTML:

<ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="services.html">Services</a></li>
    <li><a href="contact.html">Contact</a></li>
    <li><a></a></li>
    <li><a></a></li>
</ul>
like image 375
Mike Avatar asked Jan 23 '26 08:01

Mike


1 Answers

You see all links on the right because each <li> still fills the whole width, even when floated.

Try this:

.navbar1 li {
    width: 120px;
    float: left;
}

You may want another overflow: hidden; here, just to be safe.

Working example: http://jsfiddle.net/kobi/kLRLv/

like image 111
Kobi Avatar answered Jan 25 '26 21:01

Kobi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!