CSS MCQs – Advanced Layout Techniques with Flexbox and Grid

11.) In Flexbox, what is the default value of the flex-direction property?

A) row
B) row-reverse
C) column
D) column-reverse

Answer: Option A

Explanation: The default value of flex-direction is row, meaning it arranges items horizontally.

12.) What does the CSS property align-self do in Flexbox?

A) Aligns flex items along the main axis
B) Aligns flex items along the cross-axis
C) Adjusts the size of flex items
D) Aligns a flex item within its flex container along the cross-axis

Answer: Option D

Explanation: The align-self property allows individual flex items to align themselves within their flex container along the cross-axis.

13.) Which property in Grid is used to define named grid areas?

A) grid-area
B) grid-template-areas
C) grid-template-columns
D) grid-template-rows

Answer: Option B

Explanation: The grid-template-areas property is used to define named grid areas in Grid layout.

14.) What does the CSS property order do in Flexbox?

A) Sets the order of flex items within their flex container
B) Adjusts the size of flex items
C) Aligns flex items along the cross-axis
D) Aligns flex items along the main axis

Answer: Option A

Explanation: The order property allows you to change the order of flex items within their flex container.

15.) In Grid, what does the grid-auto-rows property define?

A) The size of explicit grid rows
B) The size of implicit grid rows
C) The alignment of grid items along the row axis
D) The alignment of grid items along the column axis

Answer: Option B

Explanation: The grid-auto-rows property defines the size of implicit grid rows in a grid container.

16.) What does the align-content property do in Flexbox?

A) Aligns flex items along the main axis
B) Aligns flex items along the cross-axis
C) Adjusts the size of flex items
D) Aligns a flex container’s lines within the flex container when there is extra space in the cross-axis

Answer: Option D

Explanation: The align-content property aligns a flex container’s lines within the flex container when there is extra space in the cross-axis.

17.) In Grid, what does the grid-column property define?

A) The starting column line and ending column line of a grid item
B) The starting row line and ending row line of a grid item
C) The size of grid columns
D) The size of grid rows

Answer: Option A

Explanation: The grid-column property defines the starting and ending column lines of a grid item.

18.) Which property is used in Grid to control the alignment of grid items along the row axis?

A) align-items
B) justify-content
C) justify-items
D) align-content

Answer: Option C

Explanation: The justify-items property controls the alignment of grid items along the row axis in Grid layout.

19.) What does the place-content property do in Grid?

A) It combines the properties justify-content and align-content in one declaration
B) It aligns individual grid items along the column axis
C) It controls the placement of a grid item within its grid area
D) It sets the size of grid columns and rows

Answer: Option A

Explanation: The place-content property combines the properties justify-content and align-content in one declaration for Grid layout.

20.) What CSS property is used to create a responsive grid layout in CSS?

A) display: inline-block;
B) display: table;
C) display: flex;
D) display: grid;

Answer: Option D

Explanation: The display: grid; property is used to create a responsive grid layout in CSS.

Leave a Reply

Your email address will not be published. Required fields are marked *