This paper is based on the learning notes in Mu-net.
Introduction to CSS
All called cascading style sheets (cascading style Sheets), which is primarily used to define the display style of HTML content within the browser, such as text size, color, font bold, and so on.
Example:
p{ font-size:12px; color:red; Font-weight:bold;}
Advantage
Simple, can be shared using a style
Grammar
Selector {Attribute 1: value 1; Property 2: Value 2;}
Example:
p{font-size:12px;color:red;}
Comments
With C language style,//,/* */
Three basic styles of CSS
In the case of the same weights, priority: inline > Embedded > External.
1. Inline type
is to write the CSS code directly in the existing HTML tag.
Example:
<p style= "color:red;font-size:12px" > here the text is red. </p>
2. Embedded
It is possible to write CSS style code between <style type= "text/css" ></style> tags.
And in general, the embedded CSS style is written in
Example:
<style type= "Text/css" >span{ color:red;} </style>
3. External type
is to put the CSS code in a separate external file, this CSS style file with ". css" as the extension, in Among them, rel= "stylesheet" type= "text/css" is fixed notation cannot be modified.
Example:
<link href= "Base.css" rel= "stylesheet" type= "Text/css"/>
Understanding CSS Styles