html - Bootstrap自定义CSS规则如何设置文本装饰:none for hyperlink?

标签 html css twitter-bootstrap hyperlink

我正在使用 twitter bootstrap css,并使用一些自定义 css 来覆盖一些默认规则。 ,

但我无法从超链接中删除底部边框,

HTML

<footer>
<div class="row">
<div class="col-lg-12 footer">   
<nav>
<a href="" >first link</a>
<a href="" class="nounderline">second link</a>  
<a href="" class="nounderline"><i class="fa fa-facebook-square fa-2x"></i>     fb icon  </a> 
</nav>
</div>
</div>
</footer>    

CSS

@import url("http://maxcdn.bootstrapcdn.com/bootswatch/3.2.0/cerulean/bootstrap.min.css");
@import url("http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css");
@import url("http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css");


.footer a{
color: #000;
border-bottom: 1px dotted #000;
} 

.nounderline { text-decoration: none !important}

即使我已将类设置为 .nounderline,它仍然在超链接上显示下划线。

我试过内联指定 text-decoration: none !important

例如HTML

<a href="" class="nounderline" style="text-decoration: none !important;"><i class="fa fa-facebook-square fa-2x"></i>     fb icon  </a> 

但它仍然显示超链接的下划线。

如何去掉超链接的下划线?

http://jsfiddle.net/x4eetcve/

最佳答案

在这种情况下,它与 text-decoration 无关。 a 元素上有一条虚线边框。

.footer a {
   color: #000;
   border-bottom: 1px dotted #000; 
}

去掉 border-bottom,这样看起来就没问题了。

我已经更新了你的 fiddle ,在这里查看 http://jsfiddle.net/x4eetcve/1/


警告

如果您像 Bootstrap 期望用户那样在整个页面全局使用 footer a,那么您应该覆盖 a.underline 上的 border-bottom

关于html - Bootstrap自定义CSS规则如何设置文本装饰:none for hyperlink?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27392508/

相关文章:

html - 在 HTML 文档中包含其他页面

javascript - 同时在不同元素上运行添加类jquery

javascript - 使用 jquery 更改 div 的背景,简化流程

html - Btn 没有得到颜色

html - CSS 圆 Angular 左上角不圆。想法?

html - 如何使用 Bootstrap 在具有两个行跨度的表上旋转文本

javascript - 为弹出 div 以外的屏幕设置黑色背景

c++ - 使用 Opencv 和 Qt 对两个灰度图像进行减法的使用条款

twitter-bootstrap - Bootstrap Accordion 不适用于 -xs- 列大小

html - 我在移动 View 中所做的更改甚至适用于桌面 View 。如何避免?