gpt4 book ai didi

html - H1 标题中的字体大小调整很奇怪

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

我正在尝试使用 header 类标语在我的 header 上方制作标语。但是,更改主 h1 css 上的字体大小会使更改为零,而只要我更改其大小,标语类就会更改。我对为什么我的 header 没有响应感到困惑,感谢您的帮助。我试图让它有点相似 to this W3C example (示例 5)。

html {
font-size: 18px;
}

h1 {
font-size: 3em;
padding: 0px;
}

h1.tagline {
font-size: 1.5em;
margin-bottom: -20px;
margin-top: -20px;
}
<h1 class="tagline">Homepage for</h1>
<h1>My Name</h1>

最佳答案

我想你想要 tagline改变尺寸与 h1 的关系?如果是,将所有文本放入一个 h1 标签,使用span对于标语,<br> for the line break and a value smaller than 1em for tagline. Now the tagline font-size will change in relation if you change the字体大小 for h1`

html {
font-size: 18px;
}

h1 {
font-size: 3em;
padding: 0px;
}

h1 > span.tagline {
font-size: 0.5em;
margin-bottom: -20px;
margin-top: -20px;
}
<h1><span class="tagline">Homepage for</span>
<br>My Name</h1>

关于html - H1 标题中的字体大小调整很奇怪,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51755272/

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