我需要修改bootstrap.css
以适应我的网站。我觉得创建一个单独的custom.css
文件比直接修改bootstrap.css
更好,原因之一是如果bootstrap.css
得到更新,我将遭受重新包含所有修改的痛苦。我将为这些样式牺牲一些加载时间,但对于我覆盖的少数样式来说,这可以忽略不计。
我Hw重写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;
}