html - 我不能使用 :first-child selector in this scenario?

标签 html css css-selectors

我的 code :

<div class="allegati-item">
    <div class="allegati-titolo">Download</div>
    <a class="allegati-link" href="/documenti/DocumentoTest.pdf">Link1</a>
    <a class="allegati-link" href="/documenti/DocumentoTest.pdf">Link2</a>
</div>

.allegati-link
{
    border-top:1px solid #FF0000;
    display:block;
    margin-bottom:4px;
}

.allegati-item a.allegati-link:first-child
{
    border:0;
}​

我想删除第一个 allegati-link 元素中的边框,但由于它之前有一个 div,在 allegati-item 中,这似乎不能可能吗?

最佳答案

你可以试试这个:

.allegati-item .allegati-titolo + a.allegati-link{

关于html - 我不能使用 :first-child selector in this scenario?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11329879/

相关文章:

javascript - Onclick 粗体选择

html - 某些背景颜色未加载 Outlook 2016

html - 在内联 block 布局中为 "empty space"着色

javascript - 验证输入格式是否为小数点后两位的 float

css - 在 codeigniter 中爆炸数据

java - 无法获取使用selenium xpath动态显示的双引号中的值

c++ - Jsoup 类似于 C++ 的 html 解析器

html - 选择有或没有容器的第一个 parent

php - 如何在ajax文件上传中显示进度条

javascript - 如何创建类似俄罗斯套娃的 z-index 堆叠