Learning CSS Basics Tutorial: Understanding familiar with css syntax

CSS style declaration syntax is as follows:

Selector Selector {{ 
attribute: value set; attribute: value set; 
... 
}

A selector (Selector), the number of attributes can be set without limitation. A selector (Selector), the number of attributes can be set without limitation.

There are three main selector: Class type (Type) selector, Class selector, and the ID selector. There are three main selector: Class type (Type) selector, Class selector, and the ID selector.

Class type is selected (X) HTML tags, such as the <body> and <h1>. Class type is selected (X) HTML tags, such as the <body> and <h1>. Class and ID selector is a user-defined selectors. Class and ID selector is a user-defined selectors. We will discuss these two types of selectors after. We will discuss these two types of selectors after.

Style is "property: Settings' means of development. Style is "property: Settings' means of development. For example, if we want to set the text within an element is yellow, then use the following "attributes: Settings': For example, if we want to set the text within an element is yellow, then use the following "attributes: settings': a new front-end learning qun438905713, most in the group are zero-based learners, we help each other, answer each other, and also to prepare a lot of learning materials, welcome to the zero-based junior partner together communicate with.

color:yellow;

In the above declaration, a Color attribute, and yellow is a set value. In the above declaration, a Color attribute, and yellow is a set value.

At some point, a property may have several set value. At some point, a property may have several set value. These are usually because the property is a shortcut. These are usually because the property is a shortcut. For example, there may be four margin attribute set value, and each value represents the boundary length of each side. For example, there may be four margin attribute set value, and each value represents the boundary length of each side.

Grouping

If several selectors have the same style, they can simultaneously be declared. If several selectors have the same style, they can simultaneously be declared. This is called "grouping". This is called "grouping". For example, if <h1>, <h2>, and <h3> will have the same form, then they may be declared in the following manner: For example, if <h1>, <h2>, and <h3 > will have the same style, that they can be declared in the following manner:

h1 h3 {h3 {h2 h1 h2 
properties: setpoint; attribute: value set; 
... 
}

Descendant selectors (Descendant Selectors) descendant selectors (Descendant Selectors)

We can set that only when the armor elements within the element of B, A will use a style element. We can set that only when the armor elements within the element of B, A will use a style element. If A, then B is not an element in the elements, the elements that A can have other styles. If A, then B is not an element in the elements, the elements that A can have other styles. To achieve this goal, we will use the way of a descendant selector. To achieve this goal, we will use the way of a descendant selector.

Descendant selectors declaration syntax is: descendant selectors declaration syntax is:

[Sub] [parent selector selector selector] {[parent] [sub] {selector 
attributes: setpoint; attribute: value set; 
...  create a front end study qun438905713, most of them are zero in the group learner basis, we help each other, answer each other, and also to prepare a lot of learning materials, welcomed the zero-based junior partner to the exchange.
}

In the above declaration, only when the child selector is in the Father selector, the style will be used. In the above declaration, only when the child selector is in the Father selector, the style will be used. This type of syntax may include several generations of selectors, instead of only two generations only. This type of syntax may include several generations of selectors, instead of only two generations only.

For example, the following declaration, for example, the following declaration,

li b { li b { 
color:yellow; 
}

Representative <li> <b> within the text is yellow. Representative <li> <b> within the text is yellow. Not in the <li> of the <b> text will not apply this yellow font style. Not in the <li> of the <b> text will not apply this yellow font style.

Published 46 original articles · won praise 10 · views 40000 +

Guess you like

Origin blog.csdn.net/html886/article/details/104565124