gpt4 book ai didi

html - CSS - 如何使用 CSS 覆盖?

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

我只想改变标题文本的颜色,我不知道为什么下面的代码不起作用?

<div class="mytitle">
this is the title in white
</div>

<div class="mytitle alt">
this is the title in red
</div>
<div class="mytitle alt2">
this is the title in black
</div>




.mytitle{
font-family: Verdana, Geneva, sans-serif;
font-size: 37px !important;
line-height: 40px !important;
display:block;
font-weight: bold;
margin: 0 0 12px;
padding: 0 15px 5px 0 !important;
color: white;
width:500px;
}
.mytitle .alt{
color: red;
}
.mytitle .alt2{
color: black;
}

编辑:它只会使用“mytitle”标签,不会使用 alt 或 alt2,为什么?

最佳答案

您需要删除类定义之间的空格:

.mytitle.alt

关于html - CSS - 如何使用 CSS 覆盖?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5921762/

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