[英]How to remove hover over underline from css in bootstrap
I am new to bootstrap and CSS 我是Bootstrap和CSS的新手
I am trying using the following snippet I found on Bootsnipp. 我正在尝试使用在Bootsnipp上找到的以下代码段。
http://bootsnipp.com/snippets/xaWpR http://bootsnipp.com/snippets/xaWpR
(The link has the code and preview) (链接包含代码和预览)
I have managed to change colour and fonts the way I want but how do I remove the underline effect from the tabs? 我已经设法按需要更改颜色和字体,但是如何从选项卡中删除下划线效果?
Thank you. 谢谢。
use outline:none;
使用
outline:none;
, this will fix your dot line issue , then use text-decoration:none
to remove the default underline of anchor tag ,这将解决您的虚线问题,然后使用
text-decoration:none
删除锚标记的默认下划线
.tabs nav li.tab-current a {
outline:none;
}
.tabs nav a {
text-decoration:none;
}
Set text-decoration
to none
upon hovering the links. 悬停链接时,将
text-decoration
设置为none
。
.tabs ul li a:hover {
text-decoration: none;
}
It's always bad practice to edit the already assigned bootstrap styles. 编辑已分配的引导程序样式始终是一种不好的做法。
Simply add class to your html element and edit the class. 只需将类添加到您的html元素并编辑该类。
Let's say you have: 假设您有:
<ul>
<li>
<a class="text-center custom_a"href="#">Link</a>
</li>
<li>
<a class="text-center custom_a"href="#">Link</a>
</li>
</ul>
Now some people edit the already predefined bootstrap class: text-center
, which centers the text in the outer element, which is a really bad practice for several reasons: 现在,有些人编辑了已经预定义的引导程序类:
text-center
,该文本将文本放在外部元素text-center
,这是一个非常糟糕的做法,原因如下:
Also you can travel through DOM: 您也可以遍历DOM:
ul li a {;}
Now imagine having several uls or lis. 现在想象一下有几个ul或lis。 Then you will have to travel the DOM with pseudo-selectors.
然后,您将不得不使用伪选择器来访问DOM 。 .
。 Traveling takes more time to match the DOM element with style parameters.
将DOM元素与样式参数匹配需要花费更多时间。
In your case simply do this: 就您而言,只需执行以下操作:
.custom_a, .custom_a_hover {text-decoration:none;}
You can use this because of remove underline for hover and focus. 您可以使用此功能,因为删除下划线时可以悬停和聚焦。
.tabs nav a {
text-decoration: none;
}
.tabs nav a {
text-decoration: none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.