gpt4 book ai didi

html - Last-Of Type 和 Last-Of-Child

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:54 26 4
gpt4 key购买 nike

HTML:

<div class="plan-box">
<h3>...</h3>
<p>...</p>
</div>

<div class="plan-box">
<h3>...</h3>
<p>...</p>
</div>

CSS:

.plan-box:last-of-type {
...
}

在上面的 CSS 代码中,如果我在 .plan-box 上使用 last-of-typelast-child CSS 选择器,那么在作为段落的 .plan-box div 中选择 last-child 还是选择第二个 .plan-box div HTML 代码?

最佳答案

.plan-box:last-child 选择 plan.box 元素的最后一个

.plan-box :last-child 选择所有 plan.box 元素中的最后一个元素

Css Selectors

关于html - Last-Of Type 和 Last-Of-Child,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34410927/

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