The <p> tag has class "note", so the CSS rule .note { color: blue; } applies.
Step 2: Check other CSS rules
The .alert class styles red but does not apply here because the element does not have that class.
Final Answer:
Blue -> Option B
Quick Check:
Class matches CSS selector = blue text [OK]
Hint: Match class attribute with dot selector name [OK]
Common Mistakes:
Confusing class names and applying wrong styles
Ignoring that only matching classes apply styles
Assuming default color when class is present
4. What is wrong with this CSS if you want to style elements with class menu?
menu { font-size: 1.2rem; }
medium
A. Font size value is invalid
B. Missing curly braces
C. Class name should be uppercase
D. Missing dot before class name
Solution
Step 1: Check selector syntax
The selector menu targets elements named <menu>, not class "menu". Class selectors need a dot before the name.
Step 2: Verify other parts
Curly braces and font size are correct. Class names are case-sensitive but lowercase is valid.
Final Answer:
Missing dot before class name -> Option D
Quick Check:
Class selector needs dot (.) [OK]
Hint: Class selectors always start with a dot (.) [OK]
Common Mistakes:
Forgetting the dot before class name
Confusing element selectors with class selectors
Assuming uppercase class names are required
5. You want to style all buttons with class primary to have a blue background and white text, but only when hovered. Which CSS code correctly uses class selectors and pseudo-classes?
hard
A. .primary:hover { background-color: blue; color: white; }
B. #primary:hover { background-color: blue; color: white; }
C. button.primary { background-color: blue; color: white; }
D. .primary { background-color: blue; color: white; }
Solution
Step 1: Identify correct class selector with hover
To style elements with class "primary" on hover, use .primary:hover.
Step 2: Check other options
#primary targets an ID, not class. button.primary styles all buttons with class but not on hover. .primary styles all with class but no hover effect.
Final Answer:
.primary:hover { background-color: blue; color: white; } -> Option A