Selectors - How to use them
-
Introduction
- Selectors are used to select a certain group of elements such as "div", for all divs or ".blue", for all the elements containing the blue class.
- #idName: every element with this id.
- div, .blue: all divs and elements with a .blue class.
- p, h1: the tags p and h1.
- p.big: the tags p that also have the .big class.
- article > p: every child of <article> that is a tag <p>.
- .colored p: every tag <p> inside of an element containing the .colored class.
- .nome-classe1.nome-classe2: defines the same style to two different classes.
Syntax:
tag, tag, tag {
// style to be applied
}