underline and like a whole link

前端 未结 1 1023
轮回少年
轮回少年 2021-01-22 18:32

I am trying to underline with one line the and the

I want it all to be a link with an underline. It leaves a small spa

1条回答
  •  甜味超标
    2021-01-22 19:12

    You may add it on hover, but you need to pay attention as there is top:1px set to the icons by default so you need to remove it to have a full continuous line:

    a.good .glyphicon {
      top: 0;
    }
    
    a:hover .glyphicon {
      text-decoration: underline;
    }
    
    
    Good one   
      
    
    
    
    Bad one

    Another solution is to make them inline as by default they are inline-block and if you refer to the specification:

    Note that text decorations are not propagated to floating and absolutely positioned descendants, nor to the contents of atomic inline-level descendants such as inline blocks and inline tables.

    a .glyphicon {
      top: 0;
      display: inline;
    }
    
    
    Saber mais   
      
    
    


    And to explain the small line you see between the two icons initially:

    Underlines, overlines, and line-throughs are applied only to text (including white space, letter spacing, and word spacing): margins, borders, and padding are skipped

    So if you remove any white space you will see the line under the text only:

    UPDATE

    As pointed in the comment, different font-size between the text and the icon will make the underline different, so we may rely on border in this case:

    a:hover {
     text-decoration:none!important;
     border-bottom:1px solid
    }
    .glyphicon {
      font-size:20px;
    }
    
    
    Good one

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