HTML Classes Flashcards

1
Q

Universal Selector

A

Applies to all (each and every single) elements in a document

Example: * { }
Targets all elements in the page

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

Type Selector

A

Targets specific matches (in other words, targets a specific type of element on the page). We use the HTML element tag as the selector.

Example: h1, h2, h3 { }
This would specifically target the h1, h2, and h3 elements.

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

Class Selector

A
Matches an element whose class attribute has a value that matches whatever follows the period symbol. 
Class selectors are reusable. 

Ex. .note { }

Targets ANY element whose class value is .note

Ex.  p.note { }
 Targets p elements whose class attribute has a value of note.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Are ID selectors reusable?

A

ID Selectors are not reusable, they are a unique identifier for an element.

They have the most specificity and carry the most weight.

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

What does a descendent selector do?

A

Target elements that are descendants of other elements.

A descendent selector will appear as or, better said, consists of two or more selectors separated by white space.

For example:

p a { }
(the above would cover all a elements that sit inside of a p element [even if there are other elements nested between them, it’s not a problem]).

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

Do IDs have browser functionality?

A

Yes, we can use IDs as fragment identifiers to create anchors in a page.

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

How many IDs can an element have?

A

An element can only have one ID, and a page can only have one element with the same ID name.

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

What are common CSS pseudo classes?

A

:link, :visited, :hover; :active

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

How do you create a class selector?

A

You use a period.

Example:

.intro will select all elements with class=”intro”

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

How do you select an element with an id?

A

applesauce will select the specific element with id=”applesauce”

You use a hashtag.

Example:

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

How do you select all of a type of element?

A

You simply name the element.

Example:

p will select all the paragraph elements

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

How do you select an element with a class?

A

You do the element.class combination…. you use a period in between the type of element and the name of the class (this class name is assigned in the index html).

Example:

p.intro will select all < p > elements with class=”intro”< /p >

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