【发布时间】:2019-02-15 06:00:30
【问题描述】:
我想让这些元素用不同的字体大小填充相同的行空间。如您所见,第一个元素为行高“设置了标准”。以下所有元素的上方和下方都有空白。无论字体大小如何,我都希望所有元素都填充相同的空间(行高的 %100)。有人知道吗?谢谢!
body{
background-color: #ffffff;
background-size: cover;
border: 5px solid yellow;
margin: 0px;
padding: 0px;
}
.head1{
text-align: center;
display:inline-block;
background-color: cornflowerblue;
border: 5px solid black;
padding: 0px;
margin-right: 0px;
margin-left: 0px;
margin-top: 0px;
margin-bottom: 0px;
}
#par1{
display: inline-block;
background-color: aqua;
border: 5px solid pink;
margin: 0px;
}
#par2{
display: inline-block;
background-color: crimson;
color: #ffffff;
border: 5px solid green;
margin: 0px;
}
<h1 class="head1">Site title!</h1><p id="par1"> Here is some text! Format all this with HTML.</p><h2 class="head1">Header here.</h2><h2 class="head1">Another header.</h2><p id="par2">More paragraph text. Block vs inline? Position relative static, etc...</p>
【问题讨论】: