Classes in html Flashcards

(12 cards)

1
Q

What is the primary purpose of the class attribute in HTML?

A

It is used to define a class for an element, which can then be used for styling with CSS or manipulation with JavaScript.

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

What character is used to separate multiple class names within a single class attribute?

A

A blank space is used to separate different class names.

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

What symbol must be used in CSS to select and style an element by its class name?

A

A dot or period (.) symbol is used to access a class in CSS.

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

What would be the correct CSS selector for an HTML element with the class hcolor?

A

.hcolor

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

What is a major benefit of applying the same class to a group of different HTML elements?

A

It saves time by allowing you to apply the same styling to all elements in the group without styling each one separately.

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

Can the same class be applied to different types of HTML tags, such as a heading tag and a span tag?

A

Yes, the same class can be shared by different elements, irrespective of their tags.

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

In addition to CSS styling, in which scripting language is the class attribute commonly used to access HTML elements?

A

The class attribute is used in JavaScript to access HTML elements.

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

What mechanism does JavaScript use to access and change elements based on their class?

A

JavaScript uses Document Object Model (DOM) methods to access and manipulate elements.

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

In HTML, multiple classes can be defined inside one _____ attribute for an element.

A

class

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

To access any class in CSS, the ‘_____’ symbol is used before the class name.

A

.

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

When applying the same styling to multiple elements with the same class, what type of CSS was used in the source material’s ‘card’ example?

A

Internal CSS, written inside the <head> section of the HTML document.

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

Can a class be defined for any HTML element?

A

Yes, a class can be defined for any HTML element.

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