html - 使用列表的选项卡式导航

标签 html css tabs

调整 li 元素以填充标签栏所在的 div 的整个宽度的最佳方法是什么?

最佳答案

我宁愿不必使用 width:33%,但这行得通。

<html>
<head>
    <style type="text/css">
        div.menuTop {width:400px;border:1px solid red;}
        div.menuTop li  {float:left; width:33%; border:1px solid green;}
    </style>
</head>
<body>
    <div class="menuTop">
        <li>one</li>
        <li>two</li>
        <li>three</li>
        <div style="clear:both;"></div>
    </div>
</body>

希望对您有所帮助。

关于html - 使用列表的选项卡式导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2157824/

相关文章:

css页脚菜单显示:table and items not balanced

html - 如何在 DIV 中将元素居中

gradle - Gradle选项卡未在Android Studio 3.0中显示

javascript - Chrome 调试 HTML 事件中的 javascript

php - 网页的高度没有随着广告的增加而增加,它与容器重叠

html - 使用 CSS 停止对 <div> 中 anchor 标记的悬停效果

Angular 7 检测浏览器选项卡已激活

tabs - 单击离开时,角 Material 事件选项卡标签颜色会发生变化

javascript - React 应用程序显示空白页面

javascript - 通过 :even and :odd 向 querySelectorAll 提供索引的替代方法