selectors and how to use them
Type selectors
Universal selectors
Descendent selectors
Class selectors
ID selectors:
#id{
}
type#id{
}
similar to type.classname. only affects that type when that type is used with the id.
Child selectors:
body > p {
}
Renders only when p is a direct child of body element (an element that is directlynested inside another element, with no elements in between).
Attribute selectors:
element[attribute="value"]{
}
Exactly choose the elements that have an attribute of a "value".
element[attribute]{
}
Just choose the elements with that attribute.
element[attribute~="value"]
{
}
All elements that have the "value".
element[attribute|="value"]{
}
All elements that have an attributes of the "value" or the values starting with "value"
#id{
}
type#id{
}
similar to type.classname. only affects that type when that type is used with the id.
Child selectors:
body > p {
}
Renders only when p is a direct child of body element (an element that is directlynested inside another element, with no elements in between).
Attribute selectors:
element[attribute="value"]{
}
Exactly choose the elements that have an attribute of a "value".
element[attribute]{
}
Just choose the elements with that attribute.
element[attribute~="value"]
{
}
All elements that have the "value".
element[attribute|="value"]{
}
All elements that have an attributes of the "value" or the values starting with "value"