Priority of the three methods
If there is a situation: we use three methods to set css style for the same element at the same time, then which method is really effective? This happens in the editor on the right
1. Useinline
CSS to set the "Super Cool Internet" text topink
.
2. Then useembedded
CSS to set the text tored
.
3. Finally, useexternal style
to set the text toblue
(set in the style.css file).
But finally you can observe that the text of the short words "Super Cool Internet" is set topink
. Because these three styles have priorities, remember their priorities:Inline > Embedded> External
ButEmbedded>External styleThere is a premise: the position of the embedded css style must be behind the external style. For example, in the right code editor, the code is in front of the code (actually This is also written during development). Interested friends can try it, reverse their order, and see if their priorities change.
In fact, in summary, it is--the principle of proximity (the closer to the element being set, the higher the priority)
.