gpt4 book ai didi

css - 从第一项中删除 CSS 中的内容和选择器

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

我的 CSS 选择器带有以下代码:-

   nav { font-size:13px; }

.nav li {
display: inline-block;
line-height:18px;
}
.nav ol, ul {
margin-bottom: 5px !important;
}

.nav a {
min-height:20px;
text-decoration:none;
color:#fff;
display:block;
padding: 20px 20px 10px 0;
}

.nav a:before {
content: "| ";
color: #00aeef;
margin-right: 5px;
}



.nav a:hover {
color:#00aeef;
}

它的作用是将“|”包含所有菜单项,但我不希望它包含在第一个菜单项中。

是这样的:-

|菜单1 |菜单2 |菜单3 |菜单4 |菜单5

我要的是Menu1不出来

非常感谢。

最佳答案

使用 :first-child选择器:

.nav a:before {
content: "| ";
color: #00aeef;
margin-right: 5px;
}

.nav li:first-child a:before {
content: "";
}

关于css - 从第一项中删除 CSS 中的内容和选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17519071/

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