0
0
CSSmarkup~5 mins

Universal selector in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the universal selector (*) do in CSS?
The universal selector (*) matches all elements on the page. It applies styles to every HTML element.
Click to reveal answer
beginner
How do you write a CSS rule that sets the font color to blue for all elements using the universal selector?
You write:
* { color: blue; }
This changes the text color of every element to blue.
Click to reveal answer
intermediate
True or False: The universal selector can be combined with other selectors to narrow down styling.
True. For example, div * selects all elements inside div elements.
Click to reveal answer
intermediate
Why should you be careful when using the universal selector (*) in CSS?
Because it applies styles to every element, it can slow down the page and override specific styles unintentionally.
Click to reveal answer
beginner
Give an example of using the universal selector to reset margin and padding for all elements.
Example:
* { margin: 0; padding: 0; }
This removes default spacing from all elements, useful for consistent layout.
Click to reveal answer
What does the CSS universal selector (*) select?
AAll elements on the page
BOnly <div> elements
COnly elements with a class
DOnly elements with an ID
Which CSS rule uses the universal selector to remove all default margin and padding?
A#all { margin: 0; padding: 0; }
Bdiv { margin: 0; padding: 0; }
C.all { margin: 0; padding: 0; }
D* { margin: 0; padding: 0; }
What is a potential downside of using the universal selector (*) in CSS?
AIt can slow down page rendering
BIt only styles one element
CIt does not work in modern browsers
DIt only applies to images
How can you select all elements inside a <section> using the universal selector?
Asection
B* section
Csection *
D*
Which of these selectors is the universal selector?
A#
B*
C.
D>
Explain what the universal selector (*) does in CSS and give a simple example.
Think about how you would style every element on a page at once.
You got /3 concepts.
    Describe one advantage and one disadvantage of using the universal selector in your CSS.
    Consider performance and control over styling.
    You got /2 concepts.