-align:center;padding-top:5px;} #level4 {border:1px solid gray;width:20px;height:20px;float:left;color:green; margin-right:5px;text-align:center;padding-top:5px;} #level5 {border:1px solid gray;width:20px;height:20px;float:left;color:blue; margin-right:5px;text-align:center;padding-top:5px;}
The effect of Figure 1 can now be completed.
Third, interactive style implementation
Next, by analyzing demand 2, we found that as long as you clicked on each Li element, you gave the element a bold an
One of the main advantages of CSS is that it makes it easy to apply a set of styles to all the same types of elements. Of course it is done by selectors.Basic rule structure:syntax = selector + declaration block1. Element selector--use HTML element name directly, point to document ElementUsing the element selector is the best choice if you want to add indentation to all paragraphs.p{ Text-indent:2em; }2. class
ID is different, it must be worn out. The principle I have summed up through practice is that IDs need to be unique and used as much as possible on the periphery. Class is repeatable and is used within the structure as much as possible. The benefit of this is that it helps to maintain and modify the site code later, so that all classes become children of IDs or grandchildren.
You can have two sons, but you can have two dads, that's the truth. When we
Css
In CSS, pattern matching rules determine which element of the document tree The style rule applies to. These patterns are called selectors (selector). A CSS rule is a selector {property: Value; property: Value;} (Selector {property:value;property1:value2;} , that is, the selector determines which element the declaration (declaration) in {} matches.
The select
In addition to selecting elements based on the ID (#), Class (.), attributes ([]), the element selector for CSS has an important category, which is to select elements based on their special state. They are pseudo-classes and pseudo-elements. Unlike the ID selector, class selector, property selector, and derived selectors, and so on, these get elements from the HT
In the CSS beginner's tutorial we only consider HTML selectors--appearing as HTML tags.You can, of course, define your own selectors with the class selector class and the identity selector ID.The advantage of doing this is that depending on the class or ID, you can perform the same HTML element differently.In
Recognize the class and id selector of CSSIn the CSS Elementary tutorial, we only consider the HTML selector-in the form of HTML tags. Of course, you can use the class selector and the identifier selector id to define your own selector. The benefit of doing so is that depending on the class or id, you can behave the sa
css| Tutorials | Getting started This is the first day of the last half month, around 20:00 to work, thinking about this tutorial has not been completed, the feeling is very not practical. Just resigned two months ago, would like to complete the tutorial, but due to a misfortune, resulting in the hard disk of the majority of the data lost, the half of the tutorial has been written in the Ashes. But recently a lot of netizens through the blog, QQ, MSN,
Pseudo-category-dynamic linkPseudo-classes can be seen as a special class selector, which is a special Selector automatically recognized by browsers that support CSS. Its biggest use is to define different style effects for links in different states.1. SyntaxThe pseudo-class syntax adds a pseudo class to the original s
CSS3 Target pseudo-class has to say those things (plain CSS implements tab switching)Do you think target looks familiar?!This is not the HTML The target pseudo-class is a new property of CSS3.When it comes to pseudo-classes, the CSS properties are sure to know: hover,: Link,: Visited,: Focus, etc., target usage is expa
Base.jsvar $=function ()//Call{return new Base ();};//Object typefunction Base (){ //Create an array to get an array of nodes and nodesthis.elements=[];//privatization, not shared }//Get ID nodebase.prototype.getid=function (ID){This.elements.push (document.getElementById (ID));return this;};//Get element nodebase.prototype.gettagname=function (TAG){var tags=document.getelementsbytagname (tag);For (var i=0;i {This.elements.push (Tags[i]); }return this;};//
: First-child
Add a style to the first child element of an element
: lang
Add a style to an element with the specified Lang property
Note: In the CSS definition, the same element: hover must be located in: Link,: Visited before it takes effect: active must be in: hover before it takes effect.CSS pseudo-elements (pseudo-elements): Used to set special effects to certain selectors, is to set and manipul
pseudo-classes can only be so? Why is this order?It is important to have a rule in the CSS cascade, which is to overwrite the front, so the order of the pseudo-class needs to be carefully considered."1" link and visited must be in the front, and there is no order, otherwise the effect of link or visited will be overwritten[Note that]link and visited are called static pseudo-classes and can only be applied
. example. pp{ Color:orange;}. example.pp2 { color:green;}
As in the above two definitions one is the middle there are spaces, one is the middle no space.
The first class to write to this effect:
Excuse me, why is this??
. example. PP = E F is a descendant selector.
The. Example.pp2 is an element on which the element includes these two classes to be effective.
There is a difference between the two, there is a big difference!
Example. PP is separate
1. Pseudo-Class selectorsIn CSS, the most commonly used pseudo-class selectors are several selectors that are used on a (anchor) element, and they are used in the following ways:A:link{color: #FF0000; Text-decoration:none}A:visited{color: #FF0000; Text-decoration:none}A:hover{color: #FF0000; Text-decoration:none}A:active{color: #FF0000; Text-decoration:none}2. Ps
CSS in the pseudo-class and pseudo-elements are always confused, today reference a lot of information, also looked at some of the documents, now the pseudo-class and pseudo-elements summarized as follows:First, the Origin:Pseudo-class and pseudo-elements are introduced because some information in the document tree can
CSS prepares specific tools for some special effects, which we call "pseudo-classes". Several of which are commonly used, let's look at the four pseudo-classes that are often used to define link styles, namely:
1
:link
2
:visited
3
:hover
4
:active
Because we want to define the link style, it is essential that the anchor t
My previous
Article "
Div + CSSStyle table ID and class naming rules I mainly talked about the naming rules of ID and class. With the foundation of the previous section, what I am talking about today is
Div + CSS style sheet The use principles and skills of ID and Clas in.
First
ID
And
Class
Usage principles
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.