【发布时间】:2014-01-10 08:32:53
【问题描述】:
我需要修改bootstrap.css 以适应我的网站。我觉得创建一个单独的custom.css 文件而不是直接修改bootstrap.css 会更好,一个原因是如果bootstrap.css 得到更新,我会尝试重新包含我的所有修改。我会为这些样式牺牲一些加载时间,但对于我要覆盖的少数样式来说,这可以忽略不计。
我如何覆盖bootstrap.css 以便删除锚/类的样式?例如,如果我想删除 legend 的所有样式规则:
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 20px;
font-size: 21px;
line-height: inherit;
color: #333333;
border: 0;
border-bottom: 1px solid #e5e5e5;
}
我可以删除 bootstrap.css 中的所有内容,但如果我对覆盖 CSS 的最佳实践的理解是正确的,我应该怎么做?
明确地说,我想删除所有这些图例样式并使用父级的 CSS 值。那么结合 Pranav 的回答,我会做以下事情吗?
legend {
display: inherit !important;
width: inherit !important;
padding: inherit !important;
margin-bottom: inherit !important;
font-size: inherit !important;
line-height: inherit !important;
color: inherit !important;
border: inherit !important;
border-bottom: inherit !important;
}
(我希望有一种方法可以执行以下操作:)
legend {
clear: all;
}
【问题讨论】:
标签: html css twitter-bootstrap