gpt4 book ai didi

CSS 类 - H2 样式未显示

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

我的 .css 文件中有这个:

h2.spielbox {
margin-bottom:80px;
color:#f00;
}

a.spielbox {
text-decoration:none;
background-color:#aff;
}

但在我的 html 文件中,h2 样式没有显示,而 a 样式有效:

<div class="spielbox" style="float:left;width:320px"><h2>Testberichte</h2>

我好像对 CSS 不太了解?

最佳答案

这是因为您将类应用于 div。改为这样做:

<h2 class="spielbox">Testberichte</h2>

或者,如果您想将其留在 div 中,您可以这样做:

.spielbox h2 {
margin-bottom:80px;
color:#f00;
}
  • h2.spielboxh2 元素与类 spielbox
  • 匹配
  • .spielbox h2 匹配属于 spielbox
  • 类的任何元素中的 h2 元素

关于CSS 类 - H2 样式未显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6169618/

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