【发布时间】:2016-02-22 19:18:59
【问题描述】:
一段时间以来一直试图让它工作。我正在尝试为我的新站点创建菜单,我设置了 nav、ul 和 li 标签。当然,我的实际按钮比显示的文本略大,我希望 A 填写 LI 标记。
nav {
width: 100%;
min-width: 800px;
background-color: #EDEDED;
}
nav a {
color: #000;
text-decoration: none;
display: block;
height: 100%;
width: 100%;
}
nav ul {
list-style: none;
margin: auto auto auto 10vw;
height: 2em;
display: block;
}
nav ul li {
display: inline-block;
background-color: #DEDEDE;
vertical-align: middle;
padding: 0 50px 0 50px;
height: 2em;
line-height: 2em;
}
nav ul li:hover {
background-color: #FF0000;
}
<nav>
<ul>
<li><a href='index.php'>Home</a>
</li>
<li><a href='index.php'>Home</a>
</li>
<li><a href='index.php'>Home</a>
</li>
</ul>
</nav>
我觉得我已经尝试了所有方法:
How do I make an <a> tag the size of it's parent <li> tag for larger clickable region?
Stretching <a> tag to fill entire <li>
Expand an <a> tag to fill the space
我真的觉得我的代码应该给出相同的结果。谁能指出我犯了什么错误?
【问题讨论】:
标签: css