Add some HTML expansion to support the style sheet. These expansion allows the style sheet to be included in the HTML document, allowing the HTML document link external style sheet, allowing CSS rules to be associated with a certain type unit.
Only a few HTML expansion is required: three new units:
Style,
Span and properties
Rel = "Stylesheet" LINK; three new properties:
Class,
ID and
STYLE - these properties are used in many Body class units.
1. LINK Unit: Reference External Style Table
The property of Link includes HREF, ID, REL, REV, TITLE, TYPE. LINK is an empty HEAD unit, describing the relationship between documents and other documents or resources. Attributes REL or REV, the two must be selected, define the relationship between the two resources linked to the LINK; the mandatory property href contains the URL of the second resource. The remaining attributes (ID, TITLE, TYPE) are optional. The ID value can be a name alias, as in principle, allowing the LINK unit itself as a hypertext link; title value can be a string describing the link target. TYPE gives the MIME type of the target resource, such as the MIME type of the HTML document is "text / html". In order to reference the style sheet, the correct format of the LINK unit is: assignment Rel = "stylesheet" indicates a style sheet for the target resource. "MIME / TYPE" is the MIME type of the style sheet. Therefore, Type allows you to use a variety of different style sheet languages. For CSS style sheets, the correct MIME type assignments are: type = "text / css". For the DSSSL style sheet, the correct assignment is "Application / DSSSL", and the value is "Application / JavaScript" for JavaScript Accessible. It should be noted that a document can contain more than one Link unit that references an external style sheet.
2. Style unit
Style contains a style table instruction that acts on the document. The Style unit contains two optional properties: Title, Type. The value of the Title is the topic associated with the style sheet. If multiple style sheets are applied in the document, Title can be used as a label of a style sheet, and the user can choose to make different style sheets. But there is currently no browser to provide this feature. TYPE gives the MIME type of the style table content. The Style unit allows the formatted information to be placed in the current document, rather than placing in the second file being referenced by the Link unit. Therefore, the Style unit can be used in those browsers that support the style sheet but do not support the LINK unit. Style also has two important purposes: developing and testing a style sheet; customizing an external style sheet. Therefore, a small range of layout can be performed by a STYLE unit, and more layout details are completed by the linked external style sheet.
3. SPAN unit: Select text with special styles
Usage: .... span> SPAN is used to mark the text that defines its special style by the associated style table. SPAN does not affect the style without a pattern of table instructions. SPAN can be regarded as an alternative to Font in a general sense. Span has three optional properties - Class, ID, Style. These attributes are intended to support styles tables, which are almost supported by all the textuals.
4. Class property
Usage: Class = "(Name)" (Optional) Class specifying the class name of the unit, which makes the unit subclass (Subclassing). A variety of units may have the same Class attribute value. Therefore, subclass is very useful for structured documents. The CSS style sheet can specify a rule for all units with a particular class value, or a single unit for having a particular class value. The class value is reflected in the selectors, which in front of it (the selection is part of the rule, which means which units are used for rules). Note: The cell name and class value are separated by the period. This usage will bring some problems when the class value itself contains a period. The CSS syntax rules use a backslash to "escape" special characters like a period. For example, there is such assignment "class = nacs.lisp", which should be represented in the CSS selector: "NACS / .LISP". However, this escape mechanism has not been widely supported. 4. ID attribute
Usage: ID = "(Name)" (Optional) ID Unnot Specify the unit identifier. That is to say, in the same document, there is no ID value of the two units. This is exactly the opposite of CLASS, and different units can have the same Class value. The CSS style sheet can specify a rule for a particular ID or a unit having a specific ID value. In the selector, there is a "#" number before the id value. As in principle, the unit identified by the ID can be used as a target of hypertext link: the role that ID initially designed is the same as the NAME attribute of the positioning unit. However, current majority browsers do not support this approach. Like Class, the ID value contains the sentence to cause some problems because the CSS syntactor analyzer will see the starting flag of the Class property value.
5. Style property
Usage: style = "(CSS Declaration)" (Optional) The style property contains the style sheet instruction, which will act on the contents associated with it. Use the style attribute to avoid the need for the document header on the STYLE unit, and is also one of the ways to eliminate local style table instructions in the HTML tag. Note that this method is not worth promoting, a good way to place all style sheet instructions in a Style unit or in an external style table file that is linked. The value assigned to the Style must be a valid CSS declaration separated by a semicolon. Note that some statements are quoted. Since double quotes in both sides can cause conflicts on both sides of the Style attribute, it must be included in the CSS feature placed in the stylelele with single quotation marks.
6. Simple pseudo-class selection