How make text-decoration: underline with 2px padding?

后端 未结 10 2348
無奈伤痛
無奈伤痛 2021-02-07 02:19

I like an obedient frotend developer must create underline with 2px padding instead of 1px by default. Is exist simple solution for this?

PS Yeahh guys, I know about div

相关标签:
10条回答
  • 2021-02-07 02:41

    Simply use:

    text-decoration: underline;
    text-underline-position: under;
    

    image

    0 讨论(0)
  • 2021-02-07 02:41

    This is my solution...

    HTML

    <p>hola dasf  hola dasdsaddasds dsadasdd<span></span></p>
    

    CSS

    p {
      color: red;
      text-decoration: none;
      position: absolute;
    }
    a:hover {
        color: blue;
    }
    p span {
        display:block;
        border-bottom:3px solid black;
        width: 50%;
        padding-bottom: 4px;
    }
    
    0 讨论(0)
  • 2021-02-07 02:42

    #line{
        text-decoration-line: underline;
        text-underline-offset: 1px;
    }
    <div id="line">
    Text with line
    </div>


    just use

    {
        text-decoration-line: underline;
        text-underline-offset: 2px;
    }
    
    0 讨论(0)
  • 2021-02-07 02:49

    Try this:

    .yourElement{
    border-bottom: 1px solid #000;
    line-height: 2;
    }
    
    0 讨论(0)
提交回复
热议问题