Css usage and css usage
Css (Cascading Style Sheet) is a page beautification method. By editing Css object attributes, You can beautify the page. The basic unit of Css operations is an object. CSS is like a function in C ++/C. CSS objects are like functions. They are used by definition, declaration, and call.
CSS has three selectors (object definition and usage): Tag selector, category selector, and ID selector.
CSS has four methods: inline, link, and pilot
Tag selector:
Definition: referenced style object name {tag property: property value ;.......}
Eg: h1, h2 {text-align: center; color: red ;}
Use:
<H2> ........ </H2>
CATEGORY selector:
Definition: Tag name. Class Name {tag property: attribute value ;.......} Or
. Class Name {tag attribute: attribute value ;.......}
Eg: p. center {text-align: center ;}
. Right {text-align: right ;}
Use: <p class = "center"> ........ </P>
<H1 class = "right"> ........ </H1>
(* Difference: the last format indicates that all labels with class attribute values being class names comply with the style defined by this class)
(Eg: Defines. right {text-align: right;}. When calling, as long as the label of the right attribute is called through the class, the right attribute can be displayed. <H2 class = "right"> ..... </H2>; <p class = "right"> ...... </P>; <span class = "right"> ...... </Span>; labels and so on all show right-aligned attributes. )
ID selector:
Definition: # id name {tag attribute: attribute value ;.......}
Eg: # sample {font-family:; don't-size: 60pt ;}
Use: <p id = sample> ...... </P>
Inline style:
You do not need to define the selector. You can use the style attribute to directly design the style for the element.
Eg: <p style = "color: # FF0000"> ...... </P>
Embedded:
Define the selector first and define the style sheet between
Eg:
Link:
The defined object is stored in a file with the extension .css. When you use the <link> label to link to the desired webpage, the object is placed between
Eg: <link href?”xxx.css "type =" text/css "rel =" stylesheet ">
Import:
Similar to the link method, it is imported only through the import method.
Eg: <style type = "text/css"> @ import url(xxx.css); </style>
CSS style sheet priority:
Embedded style sheet> inline> external> browser default
16:28:52