Here are quizzes on CSS introduction, covering topics like CSS syntax, selectors, how to add CSS, and using comments in CSS for clear styling.
Question 1
In a CSS rule, what does the part inside the curly braces represent?
Selector
Element
Declaration Block
Attribute Block
Question 2
What will be the result of the following CSS?
div {
margin: 20px 10px;
}
20px on all sides
20px top & bottom, 10px left & right
10px top & bottom, 20px left & right
Only margin-top and margin-right are applied
Question 3
Which color format defines color based on hue, saturation, and lightness?
RGB
HEX
HSL
RGBA
Question 4
Which CSS property is used to apply a linear gradient to an element?
background-style
gradient-color
background-image
background-gradient
Question 5
What will this CSS do?
div {
background: red url('bg.jpg') no-repeat center;
}
Only a red background is applied
Only the image is applied with no color
The image is repeated with a red overlay
Red background with image centered and not repeated
Question 6
What is the fallback font in this declaration? font-family: "Roboto", sans-serif;
Roboto
serif
sans-serif
Times New Roman
Question 7
What will margin: 10px 20px;
apply?
10px top and bottom, 20px left and right
10px left and right, 20px top and bottom
20px all around
No margin
Question 8
What does the CSS rule border: 2px solid red;
define?
Padding thickness
Margin thickness
Border color only
Border width, style, and color
Question 9
What does line-height: 1.5;
mean?
Sets font size to 1.5px
Makes text bold
Sets spacing between letters
Sets line spacing to 1.5 times the font size
Question 10
How does box-sizing: border-box
affect the layout?
Increases total element size
Only applies padding
Includes padding and border inside the defined width
Excludes content from total width
There are 10 questions to complete.