css| Tutorial | style sheet
class
In order to define the Web page format more accurately, it is necessary to make the same selectors can be categorized, and can be different categories for different style design. The basic format is as follows:
Selector. Category name {property: value}
A category name can be referenced in an character of an HTML ID:
< identifier class= category name > Web page content
Instance:
<title> CSS Example </title>
<style type= "Text/css"
!--
p.english{font-family: "Courier New"}
P.chinese{font-family: Young Round}
-->
</style>
<body>
<p Id=english>5dmedia Studio </p>
<p id=chinese> the original charm! </p>
</body>
ID
ID, which is to send an "id" to the style in HTML text, to ensure that it has the only available value in an HTML document, and that this uniqueness is also handy for scripting languages such as JavaScript.
The use of IDs is similar to class, but it begins with a # sign rather than a dot.
Instance:
<title> CSS Example </title>
<style type= "Text/css"
!--
#English {font-family: "Courier New"}
#Chinese {font-family: Young round}
-->
</style>
<body>
</body>
Pseudo class
In addition to the above classification methods, in order to make the use of classification more flexible and diverse, but also produced the concept of Pseudo-class. What is the difference between a class and a pseudo class?
Generally speaking, a selector can be set in bundles with multiple classes, so that although it can create many different styles for the same selector, the form of bundling also restricts the set class to be used by other selectors. Pseudo class is created to solve this problem, each of the predefined pseudo class can be referenced by all HTML identifiers, of course, some block-level content, except the settings.
In this case, only the most common type of anchor pseudo class in Pseudo class, the anchor pseudo class can specify a element to display the link in a different way, when the mouse encounters a link, a link that has been visited, and a link that is being activated, and a visited link can be defined as a different color display, font size, and style.
The basic format is as follows:
. Pseudo class Name {property: value}
A pseudo class can be referenced in HTML by any identifier.
< identifier class= pseudo class name > Web page content
Instance:
<title> CSS Example </title>
<style type= "Text/css"
!--
a:hover{font-size:18pt}/* when the mouse touches the link * *
-->
</style>
<body>
<a Href= "#" >5dmedia Studio </body>