需要使用标题文本调整行[重复]

问题描述 投票:-1回答:1

当我去多线时,我遇到了带标题的问题。它将比文本可见区域更大。

我怎么能这样做?

.heading-bordered {
  font-size: 32px;
  margin: 20px;
  width: 350px;
  text-align: center;
  position: relative;
}

.heading-bordered span {
  display: inline-block;
  position: relative;
  padding-bottom: 10px;
}

.heading-bordered span:before{
  height: 2px;
  background: #333;
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
}
<div class="heading-bordered">
  <span>This is so long heading and so long....</span>
</div>

enter image description here

html css
1个回答
-2
投票

试试这个

.heading-bordered span:before {
    height: 2px;
    background: #333;
    content: '';
    position: absolute;
    left: 25px;
    right: 25px;
    top: 100%;
}
© www.soinside.com 2019 - 2024. All rights reserved.