W3Schools HTML Classes

W3Schools HTML Classes

Assessment

Interactive Video

Computers

6th - 8th Grade

Hard

Created by

Joseph Ferraro

FREE Resource

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

To uniquely identify an element on a webpage.

To group or classify elements together for styling or scripting.

To define the type of content an element holds.

To link to an external stylesheet.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the correct CSS syntax for selecting elements that belong to a specific class named 'my-group'?

#my-group

my-group

.my-group

class='my-group'

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which statement about HTML elements and classes is true?

Only elements of the same type (e.g., all paragraphs) can share a class.

An element can only belong to one class at a time.

Different HTML elements can share the same class.

Classes are primarily used for defining element behavior, not styling.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can an HTML element be assigned to multiple classes?

By using separate class attributes for each class.

By listing multiple class names within a single class attribute, separated by commas.

By listing multiple class names within a single class attribute, separated by spaces.

An HTML element cannot belong to more than one class.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can different HTML elements share the same class?

No, only one element per class

Yes, multiple elements can share the same class

Only text elements can share a class

Only headings can share a class

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when two different elements share the same class?

Only the first element gets styled

All elements with that class get the same style

The browser ignores duplicates

The page will not load

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you separate multiple classes in one element?

With a comma

With a semicolon

With a dash

With a space

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If an element has two classes, what happens in CSS?

The element applies the styles from both classes

The element ignores one of the classes

The element gets only the last class style

The element cannot have two classes

9.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which HTML attribute would you use to assign an element to a group for styling?

id

class

style

group