我在页面中嵌入了一个css样式,但是令我困惑的是我的css样式好像没有生效。
I have a css style embedded in the page, but what confuses me is that my css style doesn’t seem to take effect
<style>
button {
background-color: red;
}
</style>
我在页面中嵌入了一个css样式,但是令我困惑的是我的css样式好像没有生效。
I have a css style embedded in the page, but what confuses me is that my css style doesn’t seem to take effect
<style>
button {
background-color: red;
}
</style>
You can use inspector to look at the styling for what’s being rendered on the right. If you do that (ctrl+shift+i) and you inspect the buttons, you’ll find the background is being set to white via this class:
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}
In this case, your styling isn’t taking precedence over this custom class,
@e.yeaw Thank you very much for answering my question,but this custom class has higher priority still confuse me.
Where should I go to learn more about prioritization issues
You can learn about the css specificity hierarchy here (scroll down a bit to see all the rules)
very good course, thank your very much
The tutorial is very detailed