Flexbox Flashcards
What is the aim of the flexbox layout?
To provide a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word “flex”).
Is the flexbox layout direction agnostic?
Yes, the flexbox layout is direction-agnostic as opposed to the regular layouts (block which is vertically-based and inline which is horizontally-based).
What is the most appropriate layout for the components of an application and small-scale layouts, Flexbox or Grid?
Flexbox layout is most appropriate to the components of an application, and small-scale layouts, while the Grid layout is intended for larger scale layouts.
What is a “flex container”?
A parent element with flex properties.
What is a “flex item”?
A child element with flex properites
If “regular” layout is based on both block and inline flow directions, the flex layout is based on ___?
flex-flow directions
How do you define a flex container?
.container { display: flex; /* or inline-flex */ }
What path will flexbox items follow in a layout?
Items will be laid out following either the main axis (from main-start to main-end) or the cross axis (from cross-start to cross-end).
What is the main axis of a flex container?
The main axis of a flex container is the primary axis along which flex items are laid out.
Does the main axis follow a horizontal path?
It is not necessarily horizontal; it depends on the flex-direction property.
What is the cross axis?
The axis perpendicular to the main axis is called the cross axis. Its direction depends on the main axis direction.
Is display
a property for the parent or the child?
Parent – This defines a flex container; inline or block depending on the given value. It enables a flex context for all its direct children.
Is order
a property for the parent or the child?
Child – By default, flex items are laid out in the source order. However, the order property controls the order in which they appear in the flex container.
.item { order: 5; /* default is 0 */ }
Is flex-direction
a property for the parent or the child?
Parent – This establishes the main-axis, thus defining the direction flex items are placed in the flex container.
.container { flex-direction: row | row-reverse | column | column-reverse; }
Flexbox is (aside from optional wrapping) a _______-direction layout concept.
Single. Think of flex items as primarily laying out either in horizontal rows or vertical columns.