我有一个包含内容的 h3。
然后我输入很多内容,就像
我使用的唯一CSS是:
color: rgb(255, 255, 255);
font-size: 16px;
height: 40px;
line-height: 16px;
padding-left: 20px;
padding-top: 14px;
background-color: rgba(158, 179, 195);
我需要的是 h3 将扩展内容并保持相同的样式( 就像文本位于中心,上面和下面有一些宽度
最佳答案
-> 输入较大内容时,可以删除一行内容的高度或设置最小高度
h3 {
color: rgb(255, 255, 255);
font-size: 16px;
min-height: 20px;
line-height: 20px;
padding-left: 20px;
padding: 14px;
background-color: rgba(158, 179, 195);
}
<h3>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</h3>
<h3>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing.</h3>
<h3>Lorem Ipsum is simply dummy text of the printing.</h3>
关于html - H3随其内容延伸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52363999/