CSS Reference Precedence

Source: Internet
Author: User

/***************************************css Precautions *******************************************/Browser Priority: Designer design style > Browser user custom style > browser self-setting stylein HTML code: Inline style > Inner style > External reference style/************************************************************************************************/<! DOCTYPE html>

<!--Direct link plus enter will be less than the Type property --<link rel= "stylesheet" type= "Text/css" href= "Css.css" ><!--in both CSS and MYCSS, the background color is set, but the reference order is different, which results in a different display effect--<link rel= "stylesheet" type= "Text/css" href= "Mycss.css" ><!--Although the color is displayed in Mycss, it overrides the background color of the CSS, but in CSS, the font size of the header is displayed, which is the CSS style cascade effect --<style type= "Text/css" > footer{background:rgb (179, 179);} </style><!--inline style has the highest precedence, although the background color of the header is set to RGB (MYCSS, 157, 185);<!--normal display of the background style in the MYCSS, but because the inner style is defined above, the RGB (179, 179) in the style is displayed;<!--If the CSS in the external reference link is placed below the <style> inner style, the background color in the MYCSS is still displayed -<footer> Bottom Style background </footer><!--****************************** Final summary ***************************** --<!--1, regardless of the display of that style, in the style display, mainly to display the most recent style from the content, a layer of coverage (nearest principle) --<!--2,! Important the highest priority, set in an external reference CSS style, or inside a style, plus!important, with precedence over inline style -<!--*************************************************************************** --</body>/******************************************* New File css.css**************************************************** ***/<[email protected] "UTF-8"; defines the type of the CSS character, if the writing must be at the end of the ";" otherwise it will result in a syntax error, or do not write, select the default--@charset "UTF-8"; header{background:red;font-size:30px;} Footer{background:blue;}/********************************************************************************************************** ************//********************************************* New File mycss.css************************************************ ***/@charset "UTF-8"; Header{background:rgb (64, 157, 185);} Footer{background:rgb (162, 162, 233);}/********************************************************************************************************** *************/

CSS Reference Precedence

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.