CSS selectors Flashcards

1
Q

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?

A

We will separate the selectors using commas.

Ex:

th, td, p.red, div#firstred { color: red; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If I want to apply properties to all paragraphs inside a div, how do I declare that before the curly braces?

A

div p { properties }

Just a space

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do I proceed if I want to apply properties to all paragraphs which parent is a div element?

A

div > p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the 3 basic CSS Selectors?

A

The Element selector - p {…}

The ID selector - #para1 {…}

The Class selector - .center {…}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the difference between

.element .symbol

and

.element.symbol
and

.element.large .symbol

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s the difference between:

  • comma separated identifiers?
  • space separated identifiers?

Ex:

identifier_1, identifier_2, {…}

identifier_1 #identifier_2 {…}

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the difference between:

  • space separated identifiers?
  • ’>’ separated identifiers?

Ex:

A B {…}

A > B {…}

A

> 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly