CSS Fundamentals: Selectors, Box Model & Styling

20 QuestionsBeginnerPublished:

CSS Fundamentals: Selectors, Box Model & Styling

Up to 20 questions, shuffled on every run

Quiz Configuration
Enterto start

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.

  1. What does CSS stand for?

    AnswerCascading Style Sheets

  2. What is the purpose of the CSS box model?

    AnswerTo calculate the space taken by margin, border, padding, and content

  3. What is a CSS selector?

    AnswerA pattern used to identify the HTML elements that styles apply to

  4. What is the functional difference between margin and padding?

    AnswerPadding creates space inside the border; margin creates space outside

  5. In the CSS box model, what is the "content" area?

    AnswerThe innermost area where the actual text or images are displayed

  6. What is a class selector in CSS, and how is it written?

    AnswerA selector starting with a dot (.) targeting a class attribute

  7. What is an ID selector in CSS, and how is it written?

    AnswerA selector starting with a hash (#) targeting a unique element

  8. What does "specificity" mean in CSS?

    AnswerA weight system that determines which CSS rule takes precedence

  9. What is the universal selector in CSS?

    AnswerThe asterisk (*) symbol used to apply styles to every element

  10. What is the color property used for in CSS?

    AnswerTo set the foreground color (text color) of an element

  11. What is the background-color property in CSS?

    AnswerA property that sets the color behind the content of an element

  12. What is the font-size property used for in CSS?

    AnswerTo determine the height and scale of text within an element

  13. What are common units used in CSS?

    Answerpx (pixels), em (font-relative), rem (root-relative), and %

  14. What is the display property in CSS?

    AnswerA property that defines how an element is rendered in the layout

  15. What does display: block do?

    AnswerForces an element to take the full width and start on a new line

  16. What does display: inline do?

    AnswerAllows an element to flow with text without creating a new line

  17. What does display: inline-block do?

    AnswerAllows elements to sit side-by-side while respecting width and height

  18. What is the purpose of the padding property in CSS?

    AnswerTo create space between the element content and its border

  19. What is the border property used for in CSS?

    AnswerTo add a decorative or structural line around an element

  20. What is the text-align property used for?

    AnswerTo control the horizontal alignment of text within a block

  21. What does the float property do in CSS?

    AnswerPushes an element to one side and allows text to wrap around it

  22. What is a pseudo-class in CSS?

    AnswerA keyword added to a selector that specifies a special state

  23. What is a pseudo-element in CSS?

    AnswerA keyword used to style specific parts of an element, like ::before

  24. What is the difference between position: static and relative?

    AnswerStatic is the default; relative allows offsets without breaking flow

  25. What does position: absolute do?

    AnswerPositions an element relative to its nearest positioned ancestor

  26. What does z-index do in CSS?

    AnswerDetermines the stack level of elements along the vertical Z-axis

  27. What is flexbox in CSS?

    AnswerA layout model designed for distributing space among items

  28. What does justify-content do in flexbox?

    AnswerAligns items along the main axis (usually horizontally)

  29. What does align-items do in flexbox?

    AnswerAligns items along the cross axis (usually vertically)

  30. What is the difference between CSS reset and CSS normalize?

    AnswerReset clears all defaults; normalize makes them consistent

Was this useful?

You might also enjoy

Check out some of our other posts on similar topics

HTML Semantics & Web Accessibility

HTML Semantics & Web Accessibility

Welcome to the HTML Semantics & Accessibility Quiz! This quiz will test your knowledge of semantic HTML elements and web accessibility best practices. Each question has a hint to help you out, and you

JavaScript: Language Fundamentals & Modern Features

JavaScript: Language Fundamentals & Modern Features

Welcome to the JavaScript Basics Quiz! This quiz is designed to test your understanding of fundamental JavaScript concepts, syntax, and modern programming best practices. Each question is multiple-cho

TypeScript: Typed JavaScript Fundamentals

TypeScript: Typed JavaScript Fundamentals

Welcome to the TypeScript Basics Quiz! This quiz covers fundamental TypeScript concepts, static typing, and type-safe programming best practices. Each question is multiple-choice, and you'll find hint

Responsive Web Design: Mobile-First & Breakpoints

Responsive Web Design: Mobile-First & Breakpoints

Welcome to the Responsive Design Quiz! In today's mobile-first world, building websites that look great and function well on any device is essential. This quiz will test your knowledge of responsive d

GraphQL Fundamentals: Queries, Mutations & Schema Design

GraphQL Fundamentals: Queries, Mutations & Schema Design

Welcome to the GraphQL Basics Quiz! Mastering GraphQL is essential for building efficient, flexible APIs that empower clients to request exactly what they need. This quiz will test your understanding

React Fundamentals: Components, Hooks & State Management

React Fundamentals: Components, Hooks & State Management

Welcome to the React Fundamentals Quiz! This quiz will test your knowledge of core React concepts, including components, JSX, hooks, state management, props, and event handling. Whether you're new to

6 related posts