CSS selectors Flashcards
If I want to apply a bunch of properties to several selectors, which character do I use to separate these selectors before declaring the properties in curly braces?
We will separate the selectors using commas.
Ex:
th, td, p.red, div#firstred { color: red; }
If I want to apply properties to all paragraphs inside a div, how do I declare that before the curly braces?
div p { properties }
Just a space
How do I proceed if I want to apply properties to all paragraphs which parent is a div element?
div > p
What are the 3 basic CSS Selectors?
The Element selector - p {…}
The ID selector - #para1 {…}
The Class selector - .center {…}
What is the difference between
.element .symbol
and
.element.symbol
and
.element.large .symbol
What’s the difference between:
- comma separated identifiers?
- space separated identifiers?
Ex:
identifier_1, identifier_2, {…}
identifier_1 #identifier_2 {…}
What’s the difference between:
- space separated identifiers?
- ’>’ separated identifiers?
Ex:
A B {…}
A > B {…}
> is the child selector
A > B will only select B that are direct children to A (that is, there are no other elements inbetween).
A B will select any B that are inside A, even if there are other elements between them.