Bootstrap不能覆盖<p>的属性

时间:2015-10-06 11:42:46

标签: css twitter-bootstrap-3

我正在使用Bootstrap,它具有以下元素:

p {
    margin: 0 0 10px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 10px;
    margin-left: 0px;
}

我不想在标签的末尾有空格,所以我写了以下内容:

.p {
    margin: 0 0 0px !important;
    margin-bottom: 0px !important;
}

但是,空白区域仍然显示在底部。

当我查看Chrome开发者工具时,p元素未更改。

为什么我的CSS代码没有改变元素?

2 个答案:

答案 0 :(得分:1)

.p表示您指的是课程p

如果您想修改p代码的某些属性,只需使用p
那么,

p {
    margin: 0 0 0px !important;
    margin-bottom: 0px !important;
}

答案 1 :(得分:1)

.p选择类p的元素,例如。 <span class="p"></span>

你想要以下......

p {
    margin: 0 0 0px !important;
    margin-bottom: 0px !important;
}