gpt4 book ai didi

html - 定位特定元素的通用容器

转载 作者:行者123 更新时间:2023-11-28 13:13:38 25 4
gpt4 key购买 nike

<分区>

无论如何我们可以定位一个元素的容器吗?我似乎找不到办法,这里有一个例子:

HTML:

<div class="wrapper">
<div class="content" id="TopSection">
<span>Box A</span>
</div>
</div>

<div class="wrapper">
<div class="content" id="BottomSection">
<span>Box B</span>
</div>
</div>

包装器和内容都有样式类,例如:

.wrapper {
background-color: black;
}

.content {
padding: 10px 20px;
}

如何只更改 BottomSection 上包装器的背景颜色,而不添加另一个包装器类,即 wrapperB?那么我们可以定位仅包含该 ID 的包装器吗?

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