Disable underline for lowercase characters: g q p j y?

前端 未结 7 2276
清歌不尽
清歌不尽 2020-12-01 01:26

Sometimes you don\'t want an underline blindly cutting through an underlined page title!
Is there a way to automatically elegantly disable underline for

7条回答
  •  甜味超标
    2020-12-01 02:09

    Text Decoration Module Level 3 introduces text-decoration-skip

    This property specifies what parts of the element's content any text decoration affecting the element must skip over.

    You can achieve the behavior you want by setting it to ink:

    Skip over where glyphs are drawn: interrupt the decoration line to let the shape of the text show through where the text decoration would otherwise cross over a glyph. The UA must skip a small distance to either side of the glyph outline.

    h1 {
      text-decoration: underline;
      text-decoration-skip: ink;
    }

    George quietely jumped!

    Note major browsers don't support it yet.

提交回复
热议问题