Unit 3.2 CSS Flashcards

1
Q

Attribute selectors come in handy for styling:

A

Forms

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

Define “attribute selector”

A

The CSS “attribute selector” matches elements based on the presence or value of a given attribute

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

DRY CSS stands for:

A

Don’t Repeat Yourself

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

”>” combinator:

A

targets a direct child of an element

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

”+” combinator:

A

targets an element’s immediate(adjacent) sibling

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

”~” combinator:

A

targets all the specified siblings that follow an element

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

“:first-child” :

A

represents the first element among a group of sibling elements

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

“:last-child” :

A

represents the last element in a group of sibling elements

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

Define “pseudo” classes

A

a keyword added to a selector that specifies a special state of the selected element(s)

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

“:only-child” :

A

represents an element without any siblings. So targets elements with a single child.

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

“:empty” :

A

represents any element that has no children.

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

”^” : and write example

A

“begins with” tells the browser to match a piece of code that’s at the beginning of an attribute’s value.

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

”$” : and write example

A

“ends with” tells the browser to match a piece of code that’s at the end of attribute’s value.

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

“*” : and write example

A

“contains” tells the browser to matcha piece of code that can be any part of an attribute’s value

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

When do we want to use these types of selectors? (child, attribute, combinators)

A
  1. When a CMS or framework allows no access to HTML
  2. When we are unable to add classes or IDs to elements
  3. With dynamic lists or image galleries
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

“:checked” :

A

pseudo-class selector represents any radio (), checkbox (), or option ( in a ) element that is checked or toggled to an on state.

17
Q

“:disabled” :

A

pseudo-class represents any disabled element. An element is disabled if it can’t be activated (selected, clicked on, typed into, etc.) or accept focus.

18
Q

Define “:nth-child()” pseudo-class

A

the “nth-child” matches elements based on their position among a group of siblings

19
Q

With “:nth-child()” how can we target a list of elements starting with the 3rd sibling then every other item from that element?

A

Using the argument (2n+3)

20
Q

What arguments can we pass to “:nth-child()” to target either all odd siblings or all even siblings

A

(even) or (odd)

21
Q

“:nth-of-type” :

A

pseudo-class targets an element based on its position within a parent, but only if it’s a specific type of element.

22
Q

“:nth-last-of-type” :

A

pseudo-class targets the last to first element based on its position within a parent, but only if it’s a specific type of element.

23
Q

“:root” :

A

matches the root element of a tree representing the document. In HTML :root represents the element

24
Q

“:target” :

A

CSS pseudo-class represents a unique element (the target element) with an id matching the URL’s fragment.

25
Q

“:not()” :

A

pseudo-class is referred to as a negation pseudo-class because it selects everything except the element we specify in the selector.

26
Q

”::first-line and ::first-letter”

A

pseudo-elements let us target the first line of text and the first character in a line of text.

27
Q

”::before and ::after pseudo-elements” :

A

let us insert virtual elements before and after an element’s content. These virtual elements are visible to the user and are style-able with CSS, but they do not appear in the source code.

28
Q

The only way we’re able to generate pseudo-elements

A

is with the “content” property (even if it’s empty)

29
Q

Pseudo-elements do NOT work with

A

images and form elements