Skip to content

CSSclasses/_course-flexbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Flexbox Course

Walkthrough

  1. Read A Visual Guide to CSS3 Flexbox Properties
  2. Try to solve all levels in Flexbox Froggy
  3. If you get stuck try Chris Coiyer's A complete guide to Flexbox

display – Flex

display: flex; defines a flex container. This enables a flex context for all its direct children (.flex-container > .flex-child).

.flex-container {
  display: flex; /* inline-flex */
}

flex-direction

The flex-direction CSS property specifies how flex items are placed in the flex container defining the main axis and the direction (normal or reversed).

flex-direction: row;
flex-direction: row-reverse;
flex-direction: column;
flex-direction: column-reverse;

flex-direction: row

row

The flex container's main-axis is defined to be the same as the text direction. The main-start and main-end points are the same as the content direction.

row-reverse

Behaves the same as row but the main-start and main-end points are permuted.

flex-direction: column

column

The flex container's main-axis is the same as the block-axis. The main-start and main-end points are the same as the before and after points of the writing-mode.

column-reverse

Behaves the same as column but the main-start and main-end are permuted.

justify-content

flex-start

The flex items are packed starting from the main-start. Margins of the first flex item is flushed with the main-start edge of the line and each following flex item is flushed with the preceding.

flex-end

The flex items are packed starting from the main-end. The margin edge of the last flex item is flushed with the main-end edge of the line and each preceding flex item is flushed with the following.

center

The flex items are packed toward the center of the line. The flex items are flushed with each other and aligned in the center of the line. Space between the main-start edge of the line and first item and between main-end and the last item of the line is the same.

space-between

Flex items are evenly distributed along the line. The spacing is done such as the space between two adjacent items is the same. Main-start edge and main-end edge are flushed with respectively first and last flex item edges.

space-around

Flex items are evenly distributed so that the space between two adjacent items is the same. The empty space before the first and after the last items equals half of the space between two adjacent items.

align-items

flex-start

The cross-start margin edge of the flex item is flushed with the cross-start edge of the line.

flex-end

The cross-end margin edge of the flex item is flushed with the cross-end edge of the line.

center

The flex item's margin box is centered within the line on the cross-axis. If the cross-size of the item is larger than the flex container, it will overflow equally in both directions.

baseline

All flex items are aligned such that their baselines align. The item with the largest distance between its cross-start margin edge and its baseline is flushed with the cross-start edge of the line.

stretch

Flex items are stretched such as the cross-size of the item's margin box is the same as the line while respecting width and height constraints.

Global values both justify-content & align-items

  • align-items: inherit;
  • align-items: initial;
  • align-items: unset;

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published