Write a CSS selector to select all paragraph elements with a class of "highlight".
- User
Write a CSS selector to select all paragraph elements with a class of "highlight".
Assistant
Problem: Write a CSS selector to select all paragraph elements with a class of "highlight".
Approach: -
p.highlightis more specific than.highlightalone (better for avoiding style conflicts)- More performant than
.highlightsince browsers can optimize by filtering to<p>elements first - Cl
Key considerations:
- Element selector:
ptargets all paragraph elements
- Combining selectors: When concatenated without a space, they create a compound selector that requires BOTH conditions to match
- More performant than