Log in
Sign up for FREE
arrow_back
Library
4.3 CSS Selection by Class
By KATIE LEE
star
star
star
star
star
Share
share
Last updated over 1 year ago
5 questions
Add this activity
1
1
1
1
1
Question 1
1.
What is the primary purpose of using a class attribute in HTML?
A) To identify a unique element on the page
B) To apply styles to a specific group of elements
C) To create hyperlinks
D) To add comments in the code
Question 2
2.
If you have a CSS rule that applies to all `` tags with the class "alert," what would be the correct selector format?
A) ' class = alert`
B) `.alert `
C) `#alert`
D) `alert`
Question 3
3.
Why does a CSS rule with a class selector override a tag selector?
A) Class selectors are always more specific than tag selectors
B) Tag selectors are ignored if a class is present
C) Class selectors are applied first in the stylesheet
D) There is no difference; they apply equally
Question 4
4.
Which of the following statements is true regarding valid class names in HTML?
A) A class name can start with a number
B) A class name can contain spaces
C) A class name must not contain any spaces and cannot start with a number
D) A class name can be any combination of letters and numbers
Question 5
5.
If you want to create a checkerboard pattern using CSS classes, which of the following would be the best approach?
A) Use a single class for all elements and set different colors in the CSS
B) Assign multiple classes to each element and style them individually
C) Use separate classes for each color (e.g., "red" and "black") and apply them to alternating elements
D) Only use inline styles for each element to define their colors