开发者

IE6 CSS List as horizontal navigation

开发者 https://www.devze.com 2023-02-04 16:06 出处:网络
Here is my HTML: <ul class=\"links\"> <li> <a href=\"\">Home</a> </li> <li>

Here is my HTML:

<ul class="links">
        <li>
          <a href="">Home</a>
        </li>
    <li>
      <a href="google.com">Google</a>
        </li>                   
</ul>

CSS:

ul.links {
    list-style: none outside none;
    margin: 0;
    padding: 0;
}
.links li {
    float: left;
    margin: 8px 4px -2px;
}

When viewing this in IE6 the list it开发者_JAVA百科ems are 100% in width, where as I need them to be as wide as the text they contain plus the padding.

Any ideas?


.links li {
    display:inline;
}

.


When you float an element you must apply a width attribute.

width:100px; /* or whatever */

0

精彩评论

暂无评论...
验证码 换一张
取 消