Are you ready to test your CSS skills? Whether you’re a beginner or an experienced developer, this quiz will help you assess your knowledge of CSS concepts, properties, and techniques. At The Coding College, we encourage continuous learning, and quizzes are a fun way to reinforce your understanding.
Let’s dive in!
CSS Quiz Instructions
- Each question is multiple-choice or true/false.
- Choose the correct answer based on your knowledge.
- Check the answers at the end to see how you scored!
Question 1: What does CSS stand for?
- Computer Style Sheets
- Cascading Style Sheets
- Creative Style Sheets
- Colorful Style Sheets
Question 2: Which property is used to change the background color of an element?
color
background-color
bgcolor
background-style
Question 3: How do you select an element with the class header
in CSS?
header {}
.header {}
#header {}
*header {}
Question 4: What is the correct syntax for adding an external CSS file to an HTML document?
<link href="styles.css" rel="stylesheet" type="text/css">
<style src="styles.css">
<css href="styles.css">
<stylesheet src="styles.css">
Question 5: Which property is used to control the text size?
text-size
font-style
font-size
text-style
Question 6: Which value is not valid for the position
property?
static
relative
block
fixed
Question 7: How would you apply a bold font style to text?
font-weight: bold;
font-style: bold;
font-size: bold;
text-style: bold;
Question 8: What does the z-index
property do?
- Changes the transparency of an element.
- Specifies the stacking order of elements.
- Defines the zoom level of an element.
- Controls the width of an element.
Question 9: How do you create a CSS comment?
<!-- This is a comment -->
// This is a comment
/* This is a comment */
# This is a comment
Question 10: What is the default value of the position
property in CSS?
absolute
relative
static
fixed
Question 11: What is the difference between em
and rem
units in CSS?
em
is relative to the root element, whilerem
is relative to the parent element.em
is relative to the parent element, whilerem
is relative to the root element.- Both are relative to the viewport width.
- Both are absolute units.
Question 12: Which pseudo-class is used to style an element when the user hovers over it?
:focus
:hover
:active
:checked
Question 13: Which property is used to make a flex container?
display: block;
display: inline;
display: flex;
display: container;
Question 14: How can you make a website responsive using CSS?
- Use
float
for all elements. - Use media queries and relative units.
- Use inline styles.
- Use fixed widths for layouts.
Question 15: Which of the following is a valid CSS media query?
@media screen and (min-width: 768px) {}
@media (min-width: 768px)
@media screen {}
@media width: 768px {}
Answers
- Cascading Style Sheets
- background-color
- .header
- font-size
- block
- font-weight: bold;
- Specifies the stacking order of elements.
- / This is a comment /
- static
- em is relative to the parent element, while rem is relative to the root element.
- :hover
- display: flex;
- Use media queries and relative units.
- @media screen and (min-width: 768px) {}
Your Score
- 12–15: CSS Expert! You’re ready to tackle advanced web design challenges.
- 8–11: Solid foundation. Keep practicing to refine your skills.
- Below 8: Don’t worry! Explore our CSS tutorials at The Coding College to strengthen your understanding.