twitter-bootstrap: how to get rid of underlined button text when hovering over a btn-group within an -tag?

前端 未结 13 2609
有刺的猬
有刺的猬 2020-12-15 02:33

Using the markup below, the button text is underlined when hovered over. How can I get rid of that behavior?

Is there a better way to add links to a btn-group in boo

相关标签:
13条回答
  • 2020-12-15 02:54

    { text-decoration: none !important}


    EDIT 1:

    For you example only a{text-decoration: none} will works

    You can use a class not to interfere with the default behaviour of <a> tags.

    <a href="#" class="nounderline">
      <div class="btn-group">
        <button class="btn">Text</button>
        <button class="btn">Text</button>
      </div>
    </a>
    

    CSS:

    .nounderline {
      text-decoration: none !important
    }
    
    0 讨论(0)
  • 2020-12-15 02:56

    just use bootstrap class "btn" in the link it will remove underline on hover

    0 讨论(0)
  • 2020-12-15 02:57

    Easy way to remove the underline from the anchor tag if you use bootstrap. for my case, I used to like this;

     <a href="#first1" class=" nav-link">
       <button type="button" class="btn btn-warning btn-lg btn-block">
       Reserve Table
       </button>
     </a>
    
    0 讨论(0)
  • 2020-12-15 03:00
    a.btn {
      text-decoration: none;
    }
    
    0 讨论(0)
  • 2020-12-15 03:00

    The problem is that you're targeting the button, but it's the A Tag that causes the text-decoration: underline. So if you target the A tag then it should work.

    a:hover, a:focus { text-decoration: none;}
    
    0 讨论(0)
  • 2020-12-15 03:01

    Bootstrap 4+

    This is now easy to do in Bootstrap 4+

    <a href="#" class="text-decoration-none">
        <!-- That is all -->
    </a>
    
    0 讨论(0)
提交回复
热议问题