Edit line thickness of CSS 'underline' attribute

前端 未结 11 665
日久生厌
日久生厌 2020-12-02 07:35

Since you can underline any text in CSS like so:

h4 {
    text-decoration: underline;
}

How can you also then edit the \'line\' that is drawn

11条回答
  •  鱼传尺愫
    2020-12-02 08:27

    My Solution : https://codepen.io/SOLESHOE/pen/QqJXYj

    {
        display: inline-block;
        border-bottom: 1px solid;
        padding-bottom: 0;
        line-height: 70%;
    }
    

    You can adjust underline position with line-height value, underline thickness and style with border-bottom.

    Beware to disable default underline behavior if you want to underline an href.

提交回复
热议问题