next to you Describes the four basic ways to apply the established style sheet to a Web page. One, use the Style property: Add the Style property directly to the individual component labels. < component (label) style= "Property (property) 1: Set value 1; Property (Attribute) 2: Set value 2; ...} For example: <td style= "Color:blue font-size:9pt; font-family:" superscript italics; line-height:150%> The advantage of this usage is that it can be cleverly applied in each label, But the disadvantage is that there is no "uniformity" of the whole document. Two, use style tags: write style rules in <STYLE>...</STYLE> tags. <style type= "Text/css" <!-- Style rules table --> </style> For example: <style type= "Text/css" <!-- Body { Color:blue Background: #FFFFCC; Font-size:9pt} TD, P { Color:green; FONT-SIZE:9PT} </STYLE> usually writes the entire <STYLE>...</STYLE> structure on the Web page <HEAD> Third, use the LINK tag: Write style rules in the. CSS style file, then introduce the <LINK> tag. Suppose we save the style rule as a example.css file, we just add the <link rel=stylesheet type= "text/css" href= "Example.css" to the Web page.gt; You can apply this style file to a good style. The link tag is usually written in the <HEAD> </HEAD> section of the Web page. The advantage of this usage is that you can assign several files of the same style rule to the same style file. Disadvantages are also insufficient flexibility in individual files or components. Four, use @import Introduction: And link usage is very similar, but must put in <STYLE>...</STYLE>. <style type= "Text/css" <!-- @import URL (the address, path, and file name of the introduced style sheet); </STYLE> For example: <style type= "Text/css" <!-- @import URL (http://yourweb/ EXAMPLE.CSS); </STYLE> Note that the semicolon at the end of the line is absolutely essential! Remember, remember! Obviously, both link and @import may be able to apply directly to other people's existing style sheets. However, based on the Internet etiquette, this kind of thing do not do well, at least should also know each other's voice, must first obtain the consent of others! and each of the four application methods have their advantages and disadvantages, and you can use them in a comprehensive manner without contradicting each other. However, if the same nature of the property in the case of repeated statements, it is necessary to consider the problem of applying precedence! Generally speaking, the order of priority has the following principles: Web Designer's style setting > user's style setting > browser's style setting Style property's styling > styles label Style setting > link in the style setting the style setting of the rear declaration, the previous style setting The so-called "link in the style set" refers to the above mentioned link tag and @import introduced in the two application methods linked to the style of the set. above is the most basic CSS Declaration and application method introduction, with these basic knowledge and methods, you can start to build your stylesheet! In addition to the basic declarations and application methods mentioned above, there are other methods of declaration and application that will be introduced in the next chapter. |