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

前端 未结 7 2138
清歌不尽
清歌不尽 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:24

    If you know your background color (assuming white, in this case), give this a shot:

    h1 {
        line-height: 0.9em;
        border-bottom: 1px solid black;
        text-shadow: 2px 2px #fff, -2px 2px #fff;
    }
    

    the idea:

    1. use border-bottom, and reduce the line-height to pull the bottom of the h1 box model up.
    2. apply two non-blurred, text shadows which will be rendered behind your text, and over your border-bottom. (The first, in this example, is 2px down and to the left; the second is 2px down and to the right.)

    fiddle: http://jsfiddle.net/pmn4/a5LZE/


    fyi - browsers don't play nicely with text-shadow; use it conservatively!

    0 讨论(0)
提交回复
热议问题