Chuong4 Phan 2 CSS
Chuong4 Phan 2 CSS
NI DUNG
3/9/2013
GROUPING SELECTORS
In style sheets there are often elements with the same
style.
h1
{
color:green;
}
h2
{
color:green;
}
p
{
color:green;
}
3/9/2013
GROUPING SELECTORS
To minimize the code, you can group selectors.
Separate each selector with a comma.
In the example below we have grouped the selectors
from the code above:
h1,h2,p
{
color:green;
}
3/9/2013
NESTING SELECTORS
Example
p
{
color:blue;
text-align:center;
}
.important
{
background-color:blue;
}
.important p
{
color:white;
}
It is possible to apply a
style for a selector within
a selector.
In the example below,
one style is specified for
all p elements, and a
separate style is specified
for p elements nested
within the "important"
class:
3/9/2013
CSS DIMENSION
The CSS dimension properties allow you to control the
height and width of an element.
3/9/2013
Description
Values CSS
height
max-height
max-width
min-height
min-width
width
auto
length
%
inherit
none
length
%
inherit
none
length
%
inherit
length
%
inherit
length
%
inherit
auto
length
%
inherit
3/9/2013
3/9/2013
3/9/2013
10
11