gpt4 book ai didi

CSS:last-child 选择器不起作用?

转载 作者:太空宇宙 更新时间:2023-11-04 16:17:01 25 4
gpt4 key购买 nike

<div class="commentList">
<article class="comment " id="com21"></article>
<article class="comment " id="com20"></article>
<article class="comment " id="com19"></article>
</div>

知道为什么以下 last-child 选择器对我不起作用吗?

.comment {
width:470px;
border-bottom:1px dotted #f0f0f0;
margin-bottom:10px;
}

.comment:last-child {
border-bottom:none;
margin-bottom:0;
}

所以在这种情况下,#com19 不应在底部有边框和边距。我在这里做错了什么?

谢谢

最佳答案

看起来一切都是正确的 - 我已经创建了 jsfiddle with last-child

问题出在其他地方 - "$border"的值是多少? (它是 php 变量吗?)为确保您的语句将被使用,您可以添加 !important

关于CSS:last-child 选择器不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7282369/

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