CSS class specificity order

后端 未结 1 396
北恋
北恋 2021-01-21 13:27

I have defined my own CSS class:

.my-ui-table td {
border-width: 1px;
border: 0;
padding: 5px 10px;
border-style: hidden;
border-color: inherit;
}
相关标签:
1条回答
  • 2021-01-21 13:42

    It's not which one comes first in your class="..." order that matters, it's which one is written last in your css rules that matters. That's why its called cascading style sheets, cuz the last relevant rule, with equal or higher specificity will be applied. So if all your rules are in an external sheet and if they have equal specificity, the last one will be applied. But inline/ internal styles take precedence over external ones. (Though this doesn't mean you should use them)

    0 讨论(0)
提交回复
热议问题