CSS Fundamentals: Selectors, Box Model & Styling
CSS Fundamentals: Selectors, Box Model & Styling
Up to 20 questions, shuffled on every run
Welcome to the CSS Fundamentals quiz! This quiz will test your knowledge of CSS basics, including selectors, the box model, properties, and layout techniques. Each question is designed to reinforce key concepts and help you build a strong foundation in CSS. Good luck!
Answer key and explanations20 questions
The quiz above draws 20 questions at random from these 30, so a second attempt will not be the same run. Everything in the pool is listed here.
What does CSS stand for?
AnswerCascading Style Sheets
What is the purpose of the CSS box model?
AnswerTo calculate the space taken by margin, border, padding, and content
What is a CSS selector?
AnswerA pattern used to identify the HTML elements that styles apply to
What is the functional difference between margin and padding?
AnswerPadding creates space inside the border; margin creates space outside
In the CSS box model, what is the "content" area?
AnswerThe innermost area where the actual text or images are displayed
What is a class selector in CSS, and how is it written?
AnswerA selector starting with a dot (.) targeting a class attribute
What is an ID selector in CSS, and how is it written?
AnswerA selector starting with a hash (#) targeting a unique element
What does "specificity" mean in CSS?
AnswerA weight system that determines which CSS rule takes precedence
What is the universal selector in CSS?
AnswerThe asterisk (*) symbol used to apply styles to every element
What is the color property used for in CSS?
AnswerTo set the foreground color (text color) of an element
What is the background-color property in CSS?
AnswerA property that sets the color behind the content of an element
What is the font-size property used for in CSS?
AnswerTo determine the height and scale of text within an element
What are common units used in CSS?
Answerpx (pixels), em (font-relative), rem (root-relative), and %
What is the display property in CSS?
AnswerA property that defines how an element is rendered in the layout
What does display: block do?
AnswerForces an element to take the full width and start on a new line
What does display: inline do?
AnswerAllows an element to flow with text without creating a new line
What does display: inline-block do?
AnswerAllows elements to sit side-by-side while respecting width and height
What is the purpose of the padding property in CSS?
AnswerTo create space between the element content and its border
What is the border property used for in CSS?
AnswerTo add a decorative or structural line around an element
What is the text-align property used for?
AnswerTo control the horizontal alignment of text within a block
What does the float property do in CSS?
AnswerPushes an element to one side and allows text to wrap around it
What is a pseudo-class in CSS?
AnswerA keyword added to a selector that specifies a special state
What is a pseudo-element in CSS?
AnswerA keyword used to style specific parts of an element, like ::before
What is the difference between position: static and relative?
AnswerStatic is the default; relative allows offsets without breaking flow
What does position: absolute do?
AnswerPositions an element relative to its nearest positioned ancestor
What does z-index do in CSS?
AnswerDetermines the stack level of elements along the vertical Z-axis
What is flexbox in CSS?
AnswerA layout model designed for distributing space among items
What does justify-content do in flexbox?
AnswerAligns items along the main axis (usually horizontally)
What does align-items do in flexbox?
AnswerAligns items along the cross axis (usually vertically)
What is the difference between CSS reset and CSS normalize?
AnswerReset clears all defaults; normalize makes them consistent








