gpt4 book ai didi

css - 是否有可应用于特定类的排版 CSS 重置?

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

是否有可靠的 CSS 排版样板,它在命名空间(即类)下工作,而不是在全局范围内工作?

让我简要解释一下情况:我正在使用 CSS 重置布局,我希望能够将某个类(例如 .content)添加到 div,然后将一些统一的排版规则仅应用于该 div 的元素:

<p>This one's reset</p>
<div class="content">
<p>This one has typography rules applied</p>
</div>

最佳答案

which would then apply some uniform typography rules to that div's elements only

如果我没理解错的话,如果你想定位 div 中的 every 元素,你只需在样式表中执行此操作

div.content *{
/* YOUR STYLES */
}

如果你只想为 div 中的 p 设置样式,那么

div.content p{
/* YOUR STYLES */
}

示例: http://jsfiddle.net/8UE2D/

关于css - 是否有可应用于特定类的排版 CSS 重置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7780582/

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