gpt4 book ai didi

css - 如何: height child gives same height parent . ..?

转载 作者:行者123 更新时间:2023-11-28 18:28:47 28 4
gpt4 key购买 nike

如何获得与导航高度(填充)相同的导航高度 ...!?

nav {
width: 100%;
}
nav ul {
text-align: center;
background-color: #000;
}
nav ul li {
display: inline;
margin-right: 0.8em;
font-family:"courier new"; courier; sans-serif;
font-size: 1.4em;
}
nav ul li a {
outline: none;
color: #fff;
text-decoration: none;
padding: 1em 0.5em;
}
nav ul li a:hover {
outline: none;
text-decoration:none;
background-color: #bf2e1f;
}

fiddle > http://jsfiddle.net/redfox52/HbrkA/

谢谢!

最佳答案

链接的顶部/底部填充应为 0:

padding: 0 0.5em 

如果你想给链接添加填充,让它们成为 block 元素(example)。

关于css - 如何: height child gives same height parent . ..?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14920632/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com