What is a style sheet?
CSS is short for Cascading Style Sheet. It is translated as "stacked style form 」. It is a markup language used to (enhance) control webpage styles and allow separation of style information from webpage content.
How to add a style sheet to your webpage
You can add a style sheet to your webpage in the following three ways. The higher the style definition priority that is closest to the target. The high-priority style inherits the non-overlapping definition of the low-priority style but overwrites the overlapping definition.
Link an external Style Sheet File (Linking to a Style Sheet)
You can create an external table file (.css) and then use the link object of HTML. Example:
The code is as follows: |
Copy code |
<Head> <Title> title of article </title> <Link rel = stylesheet href = "/style.css" type = "text/css"> </Head>
|
In XML, you should add it to the declaration area as follows:
The code is as follows: |
Copy code |
<? Xml-stylesheet type = "text/css" href = "/style.css"? >>
|
Define an internal Style Block object (Embedding a Style Block)
You can insert a <STYLE>... </STYLE> block object between the <HTML> and <BODY> tags of your HTML document.
For the definition method, see style sheet syntax. Example:
The code is as follows: |
Copy code |
<Html> <Style type = "text/css"> <! -- Body {font: 10pt "Arial "} H1 {font: 15pt/17pt "Arial"; font-weight: bold; color: maroon} H2 {font: 13pt/15pt "Arial"; font-weight: bold; color: blue} P {font: 10pt/12pt "Arial"; color: black} --> </Style> <Body> |
Note that the type attribute of the style object is set to "text/css", which allows browsers that do not support this type to ignore style forms.
Inline Styles)
Inline definition is to use the style attribute definition of the object within the object tag to apply its style table attribute. Example:
<P style = "margin-left: 0.5in; margin-right: 0.5in"> the left and right outer patches are added for this line. <p>
Style Sheet Syntax (CSS Syntax)
Selector {property: value}
Parameter description:
Selector -- Selector
Property: value -- style table definition. The attribute and attribute values are separated by a colon. Definitions are separated by semicolons (;).
Inherited Value (The 'herit' Value)
Each attribute has a specified value: Inherit. It means that the value of the parent object is equal to the value of the computer. This value is usually used as an alternative. Explicitly declare that it can be emphasized.