Boost your front-end workflow with these often-overlooked HTML and…
Start QuizExplore essential CSS concepts including selectors, properties, utility classes,…
Start QuizDiscover essential CSS best practices for building maintainable and…
Start QuizExplore essential CSS techniques to enhance your web development…
Start QuizExplore essential CSS best practices to create modern, maintainable,…
Start QuizExplore essential CSS best practices for cleaner, more maintainable,…
Start QuizDiscover easy CSS techniques to make your websites look…
Start QuizExplore foundational CSS knowledge to clarify common misconceptions and…
Start QuizExplore foundational topics of CSS including selectors, properties, and…
Start QuizSharpen your frontend development expertise with practical, actionable CSS…
Start QuizExplore fundamental CSS concepts including syntax, selectors, the box…
Start QuizDiscover essential CSS tricks for efficient, responsive, and visually…
Start QuizExplore foundational CSS tips and practical code snippets that…
Start QuizBoost your frontend development expertise with essential CSS best…
Start QuizBoost your frontend skills with these essential CSS techniques…
Start QuizSharpen your frontend CSS skills with essential tips including…
Start QuizDiscover effective strategies to become more confident with CSS…
Start QuizExplore the key concepts of CSS inheritance, including which…
Start QuizExplore how CSS interacts with visual frontend tools such…
Start QuizExplore how modern CSS viewport units like lvh, svh,…
Start QuizChallenge your understanding of basic CSS concepts and selectors…
Start QuizExplore practical CSS scenario-based questions relevant to web development…
Start QuizExplore foundational CSS concepts with this quiz covering selectors,…
Start QuizTest your understanding of key CSS concepts with these…
Start QuizTest your understanding of CSS Grid and Flexbox layout…
Start QuizTest your understanding of CSS Flexbox and Grid Layout with this easy-level quiz. Assess your knowledge of core properties, layout techniques, and key differences essential for building responsive web designs using modern CSS layout systems.
This quiz contains 10 questions. Below is a complete reference of all questions, answer choices, and correct answers. You can use this section to review after taking the interactive quiz above.
Which CSS property do you use to turn a container into a flex formatting context for its children?
Correct answer: display: flex;
Explanation: The 'display: flex;' property enables flexbox layout on a container, allowing its direct children to become flex items. 'position: flex;' is not a valid CSS property, and 'flex-direction: block;' is incorrect as flex-direction only sets the direction, not the display context. 'flex-container: on;' is not a recognized CSS property.
If you set 'flex-direction: row-reverse;' on a flex container, in which direction will the main axis flow?
Correct answer: Right to left
Explanation: 'flex-direction: row-reverse;' reverses the default row flow, making the main axis go from right to left. 'Left to right' is the default for 'row'. Flexbox only uses 'top to bottom' and 'bottom to top' for column directions, not row directions.
Which property is used to define the number and size of columns in a grid container?
Correct answer: grid-template-columns
Explanation: 'grid-template-columns' specifies the column track sizes and number in a grid container, allowing explicit control over the grid structure. 'flex-columns', 'columns-set', and 'layout-cols' are not valid CSS grid properties and would not produce any effect.
To horizontally center a single flex item inside a flex container, which property should be set on the container?
Correct answer: justify-content: center;
Explanation: 'justify-content: center;' horizontally centers items along the main axis (default is horizontal in row direction) in a flex container. 'align-items: start;' aligns items to the start of the cross axis, not the center. 'float: center;' and 'item-center: horizontal;' are invalid CSS properties.
When should you prefer Grid layout over Flexbox?
Correct answer: When arranging content in both rows and columns
Explanation: Grid is intended for two-dimensional layouts, allowing you to control both rows and columns. Flexbox is mainly for one-directional layouts (row or column). Float-based layouts are unrelated to Grid, and while both flexbox and grid can be used with block or inline elements, that is not a distinguishing factor.
If you use 'display: flex;' on a container and do not specify 'flex-direction', what is the default direction?
Correct answer: Row (left to right)
Explanation: The default 'flex-direction' when not specified is 'row', meaning items are laid out from left to right. 'Column (top to bottom)' would require setting 'flex-direction: column;'. 'Row (right to left)' requires 'row-reverse', and 'grid' is not a value for flex-direction.
Which property allows a grid item to span multiple columns in a grid layout?
Correct answer: grid-column
Explanation: 'grid-column' defines the start and end line for a grid item, controlling how many columns it spans. 'flex-grow' applies to flexbox and does not influence grid item spanning. 'column-span' and 'spanning-columns' are not standard properties for grid item placement.
What does 'gap: 20px;' do when applied to a flex container?
Correct answer: Adds 20px space between each flex item
Explanation: The 'gap' property (previously called 'grid-gap') adds consistent spacing between flex items. Setting each item's width requires a different property. It does not affect borders or merge items together; its only purpose is controlling the space between items.
To vertically center all items within each grid cell, which property could you use on the grid container?
Correct answer: align-items: center;
Explanation: 'align-items: center;' centers content vertically within each grid area or cell. 'justify-items: start;' would align content to the start horizontally. 'vertical-align: middle;' only applies to inline elements, and 'center-items: vertical;' is not a valid CSS property.
What does the property 'flex-grow: 2;' do for a flex item among its siblings?
Correct answer: It allows the item to grow twice as much compared to others
Explanation: 'flex-grow: 2;' lets the flex item take up twice the available space relative to items with 'flex-grow: 1'. It does not affect order, size by pixels, or font size. The other options misunderstand the 'flex-grow' property's function in distributing extra space.