边界顶部在页面顶部被切断?
我尝试设置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>
答案 0 :(得分:1)
这将完成工作h2 { display: inline-block; }