Classes and IDs

Classes and IDs

Assessment

Interactive Video

English

6th - 8th Grade

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.

8.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the recommended practice when assigning ID attributes to HTML elements?

An ID name can be reused across different elements on the same page.

An ID name should be unique to a single HTML element on a page.

Multiple ID names can be assigned to a single HTML element.

ID names are primarily for styling and have no other functional purpose.

9.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a unique functionality of IDs that classes cannot achieve?

Applying multiple styles to a single element.

Styling elements based on their content.

Linking to specific sections within the same webpage.

Changing the font size of text.