css selector, weights

css selector
right to choose their weights
in the css, the right to choose their weights high, left whose style
right tag selector has a weight of 1
weight class selector has a weight of 10
the above mentioned id the right to choose their weights are 100
right style of weight between the lines is 1000
with the keyword! Important the css attribute weights infinity
example: P {
background: Red Important;!
}
calculation of the weight
the choice is above the weight for the sum of the superimposed is the weight of the selector weight
Examples: #auc .AP {
background-Color: Red;
} (total weight is: #auc .ap)

The weight calculation rules
inline style, such as: style + "....." with a weight of 1000
ID selector, such as: #content, a weight of 0100
class, pseudo-class, attribute selector, such as Content, a weight of 0010
type selector, pseudo-class selectors, such as div p, with a weight of 0001
to inherit the style is not the value of weights
equally weighted when the latter overwrite the previous
examples:
<style type = "text / CSS">
P .noa {
background-Color: Red;
}
.nva span {
background-Color: Aqua;
}
</ style>
</ head>
<body>
<P class = "NOA">
<span class = "Nva">
Hello
</ span >
</ P>
</ body>
Category css selector
label weights is 0001
class class weight is 0010 equivalent to 255 labels selectors
id weight is 0100 corresponding to 255 class
* wildcard represents all tags weight is 0000
descendant selector ap weights are cumulative 0011
progeny selection is .a> p weight is 0011
The selector # div intersection II.A
PA {
background: Red;
}
and diversity selector II.A, 2.d
.B II.A {
background: Red;
}

Several forms of css
1. inline style to style within a tag label tag attributes serving as
an example:
<div class = "NAV" style = "background: Red;"> ADF </ div>
the style line 2.
Examples: <style>
.div {
background-Color: Red;
}
II.A {
background-Color: Red;
}
</ style>

3. style outreach
example:
<Link the rel = "this stylesheet" type = "text / CSS" the href = "" />

css selectors of the two properties
1. inheritance
inheritance is all about with the text font properties quilt element will inherit. And the weight is 0000
2. stacking of
lamination property is to solve a major small capacity selector right, is to see that the right choice is important. Who's right major who to listen to.
0010 255 0001 equivalent

Guess you like

Origin www.cnblogs.com/hxj521/p/11905919.html