html - 如何覆盖外部类的内联 css?

标签 html css twitter-bootstrap

我正在使用 Bootstrap glyphicon 类:

.glyphicon {
    top: 1px;
    //...
}

对于单个元素,我想覆盖 top 属性,与 CSS 内联:

<span class="glyphicon glyphicon-home" style="glyphicon.top:2px"></span>

我知道这不是标准方法,但您知道我要实现的目标。

这可能吗?

最佳答案

<span class="glyphicon glyphicon-home" style="position: relative; top:2px"></span>

CSS 定位属性(上/右/下/左)仅在与 relativeabsolutefixed< 一起使用时有效 位置。

Detailed Reference

关于html - 如何覆盖外部类的内联 css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37186576/

相关文章:

javascript - 导航栏无法点击

android - 不支持在 Chrome for Android 中嵌套 <div> 吗?

html - 对齐div的图像底部

html - 使用 Play 框架时导航栏在 Bootstrap 中下降

twitter-bootstrap - Bootstrap 在 laravel 5.6 中不起作用

twitter-bootstrap - Bootstrap - 打印预览中未显示进度条

html - CSS:如何正确使用最小高度

javascript - 使用 onclick 事件暂停/停止嵌入的 YouTube 视频?

javascript - 如何检查/删除元素?

jquery - Twitter Bootstrap 3 中的垂直居中