gpt4 book ai didi

css - 如何只更改 DIV 内的 css 而不是其他任何地方?

转载 作者:技术小花猫 更新时间:2023-10-29 11:52:45 24 4
gpt4 key购买 nike

我有这段代码:

h1, h2, h3, h4{ 
color: red;
}
.message_rouge h1, h2, h3, h4,{color: black;}

为什么我的所有标题都是黑色的,而不仅仅是“message_rouge”中的标题,其余的是红色的?

谢谢:)

最佳答案

每一行都是它自己的选择器,但您只需在第一行指定 .message_rouge

改用这个:

.message_rouge h1, 
.mesage_rouge h2,
.mesage_rouge h3,
.mesage_rouge h4 {
color: black;
}

关于css - 如何只更改 DIV 内的 css 而不是其他任何地方?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10973607/

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