我无法定位这第五个 anchor 标记。我只是想在视觉上将最终 anchor 与列表的其余部分分开,但我仍然希望它分组(显然是通过 ul)
感谢任何帮助!
ul>
<li>PORTFOLIO:</li>
<li><a href="index.html">layout</a></li>
<li><a href="logo.html">logo design</a></li>
<li><a href="print.html">print design</a></li>
<li><a href="mailto:blahblahblah@yahoo.com">Contact Me</a></li>
</ul>
#mainNav a {
color:#428896;
text-decoration: underline;
}
#mainNav ul>:first-child {
letter-spacing: 2px;
text-decoration: none;
}
#mainNav ul li:nth-child(5) {
padding-left: 50px;
}
最佳答案
如果你想要最后一个 anchor 为什么不使用:
ul li:last-child a{
letter-spacing: 2px;
text-decoration: none;
color:red;
}
在你的例子中 ul 没有#mainNav id
关于CSS 选择器。我一定没有正确理解这一点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12220892/