【问题标题】:How to make a line below text without text-decoration: underline? [duplicate]如何在没有文本装饰的文本下方制作一行:下划线? [复制]
【发布时间】:2016-05-19 01:11:30
【问题描述】:

我需要在文字下方添加一行,不带text-decoration: underline; 否则如何在文本和行之间创建自定义空间。

我们做什么

【问题讨论】:

  • 试试边框底部 :)

标签: html css


【解决方案1】:

您可以使用Border-Bottom 和一些Padding-Bottom

a {
border-bottom: 1px solid black;
padding-bottom: 5px;
}
<a>Example Text</a>

您也可以使用伪元素,使用 after 或 before 在文本或其他任何内容下添加一行。

a::after {
 display: block;
   content: '';
  width: 100%;
  height: 1px;
  background: black;
  position: absolute;
  bottom: 0;
  left: 0;
}

a {
position: relative;  
}
<a>Example Text</a>

【讨论】:

    【解决方案2】:

    边框底部

    span{
      border-bottom:1px solid #000;
    }
    <span>What we do</span>

    【讨论】:

      猜你喜欢
      • 2012-03-24
      • 2021-07-11
      • 2011-12-23
      • 1970-01-01
      • 1970-01-01
      • 2012-09-30
      • 1970-01-01
      • 2013-09-26
      • 2020-03-19
      相关资源
      最近更新 更多