使用Bootstrap时,我的自定义CSS样式表不起作用。!important标签不起作用(我也听说过!important不是一个好习惯),并且使用ID代替Class不是一个好主意,因为样式将被多次使用。
有没有一种方法可以不使用ID来覆盖Bootstrap?
具有引导程序和自定义CSS链接的HTML
<header>
<nav class="navbar navbar-expand-md navbar-dark navbar-custom">
<a class="navbar-brand" href="index.html">Jake Yoon</a>
</nav>
</header>
自定义CSS
.navbar-custom {
background-color: lightsteelblue;
font-size: 25px;
color: white;
}
这可能不是最佳答案。但这就是我的管理方式:
<div class="bootstrap-classes eg.navbar">
<span class="custom-classes">hello world</span>
</div>
在父级中使用引导程序类。创建一个孩子并在上面使用您自己的类。这对我有用。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句