[英]How can i change the default Bootstrap button color to my own choice of custom color by using CSS?
.nav-link { font-family: "Montserrat"; font-weight: 300; font-size: 1.2rem; color: #ededed; }
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/> <li class="nav-item"> <a class="nav-link" href="#about">about</a> </li>
Every other element in the css part is working except the color element.除了颜色元素之外,css 部分中的所有其他元素都在工作。 When i inspected the webpage in chrome developer tool, It showed that the css is not overriding the default bootstrap button color (rgba).
当我在 chrome 开发者工具中检查网页时,它表明 css 没有覆盖默认的引导按钮颜色(rgba)。
First add a new class to your element, then over writing bootstrap styles using important
首先向您的元素添加一个新类,然后使用
important
覆盖引导样式
.nav-link { font-family: "Montserrat"; font-weight: 300; font-size: 1.2rem; color: #ededed; } .new-class{ /* over write */ color:red !important; font-size:30px !important; /* etc */ } .new-class:hover{ color:#000 !important; } .il-style { list-style:none !important; }
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/> <li class="nav-item il-style"> <a class="nav-link new-class" href="#about">about</a> </li>
style.css
after bootstrap style without using important
, but sometime you need to use it.style.css
而不使用important
,但有时你需要使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.