Classes and IDs

Classes and IDs

Assessment

Interactive Video

English

6th - 8th Grade

Practice Problem

Hard

Created by

MARTHA MONAHAN

FREE Resource

9 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary purpose of using classes and IDs in HTML and CSS?

To define the basic structure of a webpage.

To add interactivity and dynamic behavior to elements.

To target specific HTML elements for styling.

To link different HTML pages together.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you style an HTML element (like `h2` or `p`) directly in CSS without using a class or ID?

Only the first instance of that element on the page will be styled.

All instances of that element on the entire website will receive the specified styling.

The styling will only apply if the element is nested within a `div` tag.

The styling will be ignored by the browser.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you assign a class to an HTML element?

Using the `id` attribute, e.g., `

`.

Using the `style` attribute, e.g., `

`.

Using the `class` attribute, e.g., `

`.

By wrapping the element in a `` tag.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In CSS, what symbol is used to target an HTML element by its class name?

# (hash symbol)

. (period/dot)

* (asterisk)

> (greater than symbol)

5.

MULTIPLE CHOICE QUESTION

30 sec • Ungraded

Are you enjoying the video lesson?

Yes

No

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How are IDs selected in CSS compared to classes?

IDs use a dot (.), classes use a hash (#).

IDs use a hash (#), classes use a dot (.).

Both use a dot (.).

Both use a hash (#).

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a key difference between HTML classes and IDs regarding their usage on a page?

Classes must be unique, while IDs can be reused.

IDs must be unique per element or page, while classes can be applied to multiple elements.

Both classes and IDs must be unique per page.

Both classes and IDs can be applied to multiple elements.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?