【发布时间】:2019-06-03 05:32:17
【问题描述】:
border-top 被页面顶部截断??
我已尝试设置 h2 元素的 margin-top,但结果仍然相同。
body {
font-family: 'Open Sans', sans-serif;
height: auto;
margin: 0;
background: #222;
}
#heading-background {
background: #55d6aa;
height: 50px;
color: rgba(255, 255, 255, 1);
}
h2 {
color: #222;
padding: 0 0 0 14px;
margin: 10px 0 0 20px;
font-size: 28px;
letter-spacing: 0.5em;
display: inline;
border: 2px solid #222;
border-radius: 8px;
}
<div id="heading">
<div id="heading-background">
<div id="heading-text">
<h2>TODO</h2>
</div>
</div>
</div>
【问题讨论】:
-
内联块,不是内联
-
副本处理边距,同样适用于填充/边框(将找到其他副本)
-
@TemaniAfif 我对 Web 开发领域比较陌生,所以我没有太多经验。谢谢你的帮助,我现在明白了!