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. UseinlineCSS to set the "Super Cool Internet" text topink.

2. Then useembeddedCSS to set the text tored.

3. Finally, useexternal styleto 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).

Continuing Learning
||
样式网页

PHP中文网,超酷的互联网、IT技术免费学习平台,创新的网络一站式学习、实践体验;服务及时贴心,内容专业、有趣易学。专注服务互联网工程师快速成为技术高手!

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!