Responsive Web Design Flashcards
Columns
Columns are defined as the vertical sections that span the width of a page. In web design, it’s common to see layouts consisting of 12 or 16 columns, while other may only feature three columns. Defining the number of columns depends on what’s appropriate for your design, device, and or screen viewing size. They can be dependent on each other, meaning they are used to organize related content such as a continuation of a paragraph. They can also be independent of each other, meaning they are used for organizing the layout of unrelated content such as a sidebar. This allows for the flexibility of organizing information.
Name three major components of the grid anatomy
When designing a website, the grid comprises three major components: columns, gutters, and margins.
Gutters
a gutter is the negative space between each column. Gutters help in ensuring the columns don’t run together, which would negate the purpose of using a column-based grid. No content can spill into the gutter unless it is using the next column.
Margins
Margins appear on the left and right sides of the column-based grid. These ensure the content of your designs doesn’t match up to the edges of the browser window.
It’s important to note, margins may vary depending on the width of the grid, browser window, or device. For larger displays, margins may be very noticeable while on smaller screens, they may have the same width as a gutter.
Grid rows
Rows are the horizontal lines on a grid. Think of rows as invisible boxes that group content together by height. Rows are commonly used in web designs to group content together and re-order other content to allow for more whitespace.
What’s the difference between display: flex; and display: inline-flex;?
Much like the difference between display: block; and display: inline;, the main difference between display: flex; and display: inline-flex; is that display: inline-flex; will make the flex container an inline element while its content maintains its flexbox properties.
flex-start (justify-content property)
all items will be positioned in order, starting from the left of the parent container, with no extra space between or before them.
five commonly used values for the justify-content property
flex-start
flex-end
center
space-around
space-between
flex-end (justify-content property)
all items will be positioned in order, with the last item starting on the right side of the parent container, with no extra space between or after them.
center (justify-content property)
all items will be positioned in order, in the center of the parent container with no extra space before, between, or after them.
space-around (justify-content property)
items will be positioned with equal space before and after each item, resulting in double the space between elements.
space-between (justify-content property)
items will be positioned with equal space between them, but no extra space before the first or after the last elements.
five commonly used values for the align-items property
flex-start
flex-end
center
baseline
stretch
flex-start (align-items property)
all elements will be positioned at the top of the parent container.
flex-end (align-items property)
all elements will be positioned at the bottom of the parent container.
center (align-items property)
the center of all elements will be positioned halfway between the top and bottom of the parent container.
baseline (align-items property)
the bottom of the content of all items will be aligned with each other.
stretch (align-items property)
if possible, the items will stretch from top to bottom of the container (this is the default value; elements with a specified height will not stretch; elements with a minimum height or no height specified will stretch).
flex-grow
The flex-grow property allows us to specify if items should grow to fill a container and also which items should grow proportionally more or less than others. the default value of flex-grow is 0. Margins are unaffected by flex-grow and flex-shrink.
flex-shrink
the flex-shrink property can be used to specify which elements will shrink and in what proportions. the default value of flex-shrink is 1, and this causes the flex items to shrink when the flex container is too small, even though we do not declare the property. Margins are unaffected by flex-grow and flex-shrink.
flex-basis
flex-basis allows us to specify the width of an item before it stretches or shrinks.
Is flex-basis the same as setting width?
It’s not! We can think of flex-basis as the width OR height (depending on flex-direction) of our flex items before they are constrained by a flex container.
flex (property)
The shorthand flex property provides a convenient way for specifying how elements stretch and shrink, while simplifying the CSS required. The flex property allows you to declare flex-grow, flex-shrink, and flex-basis all in one line.
Note: The flex property is different from the flex value used for the display property.
Give an example of declaring declare flex-grow, flex-shrink, and flex-basis all in one line.
.small {
flex: 1 2 100px;
}