CSS - MCQ Questions and Answers

Test your knowledge of CSS with these interactive multiple-choice questions.

« First 1 2 3 4 Last »
« Previous Page Next Page »

21. Which CSS property controls the stacking order of elements?

  • a) z-index
  • b) order
  • c) layer
  • d) stack-level
Answer: A - z-index determines the stack order of positioned elements (higher values appear on top).

22. Which CSS property creates a flex container?

  • a) display: flex
  • b) display: inline-flex
  • c) Both a and b
  • d) flex: true
Answer: C - Both flex and inline-flex enable Flexbox layout.

23. Which CSS property aligns flex items along the main axis?

  • a) justify-content
  • b) align-items
  • c) flex-align
  • d) content-align
Answer: A - justify-content controls alignment on the main axis (e.g., center, space-between).

24. Which CSS property aligns flex items along the cross axis?

  • a) align-items
  • b) justify-items
  • c) cross-align
  • d) flex-align
Answer: A - align-items aligns items vertically in a row or horizontally in a column.

25. Which CSS property changes the direction of flex items?

  • a) flex-direction
  • b) flex-flow
  • c) direction
  • d) flex-orientation
Answer: A - flex-direction: row|column|row-reverse|column-reverse sets the main axis direction.

26. Which CSS property allows flex items to wrap to new lines?

  • a) flex-wrap
  • b) wrap
  • c) flex-flow
  • d) flex-line
Answer: A - flex-wrap: wrap allows items to wrap when space is insufficient.

27. Which CSS shorthand property combines flex-direction and flex-wrap?

  • a) flex-flow
  • b) flex-direction
  • c) flex-wrap
  • d) flex
Answer: A - flex-flow: row wrap is shorthand for direction + wrap.

28. Which CSS property distributes space among flex items?

  • a) flex-grow
  • b) flex-shrink
  • c) flex-basis
  • d) flex-space
Answer: A - flex-grow defines how much an item grows relative to others.

29. Which CSS property defines the default size of a flex item?

  • a) flex-basis
  • b) flex-size
  • c) basis
  • d) item-size
Answer: A - flex-basis: 200px sets the initial main size of a flex item.

30. Which CSS shorthand property combines flex-grow, flex-shrink, and flex-basis?

  • a) flex
  • b) flex-flow
  • c) flex-group
  • d) flex-all
Answer: A - flex: 1 1 auto is shorthand for grow + shrink + basis.

31. Which CSS property creates a grid container?

  • a) display: grid
  • b) display: inline-grid
  • c) Both a and b
  • d) grid: true
Answer: C - Both grid and inline-grid enable CSS Grid layout.

32. Which CSS property defines grid columns?

  • a) grid-template-columns
  • b) grid-columns
  • c) columns
  • d) template-columns
Answer: A - grid-template-columns: 1fr 2fr creates two columns with a 1:2 ratio.

33. Which CSS property defines grid rows?

  • a) grid-template-rows
  • b) grid-rows
  • c) rows
  • d) template-rows
Answer: A - grid-template-rows: 100px auto sets explicit and implicit row sizes.

34. Which CSS property creates gaps between grid items?

  • a) gap
  • b) grid-gap
  • c) Both a and b
  • d) spacing
Answer: C - gap (modern) and grid-gap (legacy) define gutters between grid items.

35. Which CSS property positions a grid item along the column axis?

  • a) grid-column
  • b) grid-area
  • c) column
  • d) item-column
Answer: A - grid-column: 1 / 3 spans an item across columns 1 to 3.

36. Which CSS property positions a grid item along the row axis?

  • a) grid-row
  • b) grid-area
  • c) row
  • d) item-row
Answer: A - grid-row: 2 / 4 spans an item across rows 2 to 4.

37. Which CSS property defines named grid areas?

  • a) grid-template-areas
  • b) grid-areas
  • c) areas
  • d) template-areas
Answer: A - grid-template-areas: "header header" "sidebar main" creates visual layouts.

38. Which CSS property aligns grid items along the inline (row) axis?

  • a) justify-items
  • b) align-items
  • c) item-align
  • d) grid-align
Answer: A - justify-items aligns items horizontally in their grid cells.

39. Which CSS property aligns grid items along the block (column) axis?

  • a) align-items
  • b) justify-items
  • c) item-align
  • d) grid-align
Answer: A - align-items aligns items vertically in their grid cells.

40. Which CSS property creates a multi-column layout?

  • a) column-count
  • b) columns
  • c) multi-column
  • d) grid-columns
Answer: A - column-count: 3 splits content into 3 columns.
« First 1 2 3 Last »
« Previous Page Next Page »

Learn Computer Skills with PCBooks

Master computer skills with PCBooks! Explore interactive tutorials, MCQ tests, and online exams for programming, web development, and IT fundamentals. Perfect for beginners and advanced learners.

Online MCQ Tests for Programming

Practice programming MCQ questions and improve your coding skills with our online quizzes. Whether you're learning Python, Java, or C programming, PCBooks has you covered.

Free Web Development Tutorials

Learn HTML, CSS, and JavaScript with our free web development tutorials. Test your knowledge with interactive quizzes and online exams.