简体   繁体   English

IE6 CSS列表作为水平导航

[英]IE6 CSS List as horizontal navigation

Here is my HTML: 这是我的HTML:

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

CSS: 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 items are 100% in width, where as I need them to be as wide as the text they contain plus the padding. 在IE6中查看时,列表项的宽度为100%,在这里,我需要它们与包含的文本以及填充一样宽。

Any ideas? 有任何想法吗?

.links li {
    display:inline;
}

.

浮动元素时,必须应用width属性。

width:100px; /* or whatever */

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM