内部样式和外部样式优先级
Style rules take increasing priority as they grow closer to the element they are influencing: that is, in the case of a rule conflict, the rules for an inline style will trump those of an embedded style, and embedded style rules will be used over a linked style rule.
样式规则越接近影响的元素,其优先级就越高:也就是说,在规则冲突的情况下,内联样式的规则将胜过嵌入式样式的规则,而嵌入式样式规则将用于链接样式规则。
Style rules are synergistic if they do not conflict: a rule written in a linked style sheet will join with embedded and inline rules for the same element to create an appearance that is the result of combining the rules.
样式规则在不冲突的情况下是协同的:用链接的样式表编写的规则将与同一元素的嵌入式和内嵌规则结合在一起,以创建外观,这些外观是组合规则的结果。
All other things being equal, a conflicting rule between an id
and a class
will resolve by favouring the rule in the id
.
在其他所有条件都相同的情况下, id
和class
之间的冲突规则将通过支持id
的规则来解决。
内部样式和外部样式优先级