CSS (cascading style Sheets, cascading style sheets) is a way to beautify the page by editing the object properties of the CSS. The basic element of the operation of the CSS is the object, the use of CSS is like using a function in c++/c, CSS object is like a function, by definition, declaration, the use of the tune.
CSS has three selectors (object definition and how to use): Tag Selector, category selector, ID selector
CSS has four methods: inline, inline, linked, import
Tag Selector:
Definition: Referenced style object name {tag attribute: attribute value; Tag attribute: property value; ...}
Eg:h1,h2{text-align:center; color:red;}
Using:
Category selector:
Definition: Tag name. class Name {tag attribute: attribute value; Tag attribute: property value; ...} or
. class Name {tag attribute: attribute value; Tag attribute: property value; ...}
eg:p.center{Text-align:center;}
. right{Text-align:right;}
Use: <p class= "center" >........</p>
(* difference: The latter format indicates that all tags of the class attribute value are in accordance with the style defined by the class)
(eg: defines the. right{text-align:right;}, when called, the property of right can be displayed as long as it is a label of the property that is called by class. <H2 class= "right" >..... <span class= "right" >......</span>; and so on, the labels all show the properties that are aligned. )
ID selector:
Definition: #id名称 {Tag Property: property value; Label property: Property value; ...}
Eg: #sample {font-family: Song body; don ' t-size:60pt;}
Use: <p id=sample>......</p>
In-line:
You do not need to define selectors and use the style property to design styles directly for elements
Eg: <p style= "color: #FF0000" >......</P>
Inline type:
Define the selector to define the style sheet between
eg
<HTML> <Head> <title>Xxxxxx</title> <styletype= "Text/css">P{Color:#000FF;}. Info{font-size:12px;}</syle>
LINK Type:
The defined objects are placed separately in a file with a. css extension, in the use <link> tags link to the desired page, between
Eg: <link href= "Xxx.css" type= "Text/css" rel= "stylesheet" >
Import Type:
Similar to a linked method, it is imported only through the import method.
Eg: <style type= "text/css" > @import url (xxx.css);</style>
Precedence of CSS style sheets:
Inline style sheet > inline > External > Browser default
16:28:52 2016-10-07
Usage of CSS