CSS is an abbreviation for Cascading Style Sheets. It is a simple mechanism for adding styles to web documents, which belongs to the layout language of the performance layer.
Call style sheet
Basic syntax specification analysis A typical CSS statement:
P {color: # ff0000; Background: #ffffff} in "P" We call "selectors", indicating that we want to define style to "P"; Style declaration writes in a pair of braces "{}"; Color and Background are called "property" and different attributes with semicolons ";" separated; "#f0000" and "#fffff" are attributes Value. Color value color values can be written with RGB values, such as: color: RGB (255, 0, 0), can also be written with hexadecimal, like the above example color: # ff0000. If the hexadecimal value is a repetitive, the effect is the same. For example: #f0000 can write to # f00. But if you don't repeat, you should not be short-written, for example # fc1a1b must write over six. Defining font Web standards recommend the following font definition method:
Body {Font-Family: "Lucida Grande", Verdana, Lucida, Arial, Helvetica, Song, Sans-Serif;} The font is selected in the order listed. If the user's computer contains the Lucida Grande font, the document will be specified as Lucida Grande. No, it is specified as a Verdana font. If there is no Verdana, it is specified as a Lucida font, and the Lucida Grande font is suitable for Mac OS X; Verdana font is suitable for all Windows systems; Lucida is suitable for UNIX users; "Song" is suitable Chinese Simplified users; if the fonts listed cannot be used, the default SANS-Serif font ensures call; the group selector When several element style properties, you can call a statement, and the elements are separated by commas: P, TD, Li {Font-Size: 12px;} Derife Selector Defines the Sub Elements in Elements Use the derived selector, for example: li strong {font-style: italic; font-weight: Normal;} It is the subsidence of the subsidence from the child. Strong is defined for the subsidence of the LI. The ID selector uses the CSS layout mainly with the layer "div" to implement, while the DIV style is defined by the "ID selector". For example, we first define a layer
Then define this in the style sheet:
#menubar {margin: 0px; Background: #fefefe; color: # 666;}
Where "MenuBar" is the name of the ID you define your own. Pay attention to the "#" number in front.
The ID selector also supports derivation, for example:
#menubar p {text-align: right; margin-top: 10px;}
This method is mainly used to define layers and those that are more complex and have multiple derived elements.
Category Psef In CSS, in CSS, the category selector is defined, for example:
.14px {color: # f60; font-size: 14px;}
In the page, use the class = "category name" method to call:
14px size font span>
This method is relatively simple and flexible, and you can make new and delete according to the page at any time.
Define the style of the link to define the style of the link in four pseudo classes, namely: A: Link, A: Visited, A: Hover, and A: Active, for example:
A: Link {font-weight: bold; color: # c00;} A: visited {font-weight: bold; text-decoration: none; color: # c30;} a: hover {font- Weight: bold; text-decoration: underline; color: # f60;} A: Active {font-weight: bold; text-decoration: none; color: # f90;
The above statement defines the style of "link, accessed link, when the mouse is above, point the mouse down". Note that you must write in the above order, otherwise it may be different from you to do. Remember their order is "lvha".