我有一个具有以下类的元素:
null
.product-name {
font-size: 36px;
font-weight: 600;
border-bottom: 1px solid #dee2e6;
padding-bottom: 20px;
margin-bottom: 20px;
}
<h1 class="product-name">My awesome product </h1>
null
文本呈现如下所示:
正如您所看到的,文本上下都有一些空白。我正努力做到这一点:
那能实现吗?
我想你是说这个。我添加了行高:1;
null
.product-name {
font-size: 36px;
font-weight: 600;
border-bottom: 1px solid #dee2e6;
line-height: 1;
margin-bottom: 20px;
display: inline-block;
}
<h1 class="product-name">Aadaadf</h1>
null
.product-name {
font-size: 36px;
font-weight: 600;
border-bottom: 1px solid #dee2e6;
padding-bottom: 20px;
margin-bottom: 20px;
line-height: 30px; /* here */
}
<h1 class="product-name">My awesome product </h1>