我需要修改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;
}
Run Code Online (Sandbox Code Playgroud)
我可以删除所有内容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;
}
Run Code Online (Sandbox Code Playgroud)
(我希望有办法做以下事情:)
legend {
clear: all;
}
Run Code Online (Sandbox Code Playgroud) 我正在使用bootstrap 3.我想在点击按钮时更改按钮颜色.我的意思是按钮在选中时应该是不同的颜色.我怎么能用css做到这一点?
我的代码是:
<div class="col-sm-12" id="">
<button type="submit" class="btn btn-warning" id="1">Button1</button>
<button type="submit" class="btn btn-warning" id="2">Button2</button>
</div>
Run Code Online (Sandbox Code Playgroud)