Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 bootstrap that avoids this behavior?

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

Tested CSS lines:

a:hover .btn-group { text-decoration: none } a .btn-group:hover { text-decoration: none } a:hover .btn-group .btn { text-decoration: none } a .btn-group .btn:hover { text-decoration: none } 

Any additional !important does not work, either (suggested by baptme).

like image 942
BerndBrot Avatar asked Aug 06 '12 13:08

BerndBrot


People also ask

How do I remove the underline from a tag in bootstrap?

By setting the text-decoration to none to remove the underline from anchor tag. Syntax: text-decoration: none; Example 1: This example sets the text-decoration property to none.

How do you get rid of underlined fonts?

Right-click on the underlined text you selected. Choose "Font" from the pop-up menu to reveal the Font screen. In the Underline Style box, select "(none)." Then click "OK" to remove the underlining.


2 Answers

Bootstrap 4+

This is now easy to do in Bootstrap 4+

<a href="#" class="text-decoration-none">     <!-- That is all --> </a> 
like image 155
Mick Avatar answered Oct 08 '22 18:10

Mick


{ 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 } 
like image 27
baptme Avatar answered Oct 08 '22 20:10

baptme