Interactive tutorial

Getting Started with CSS Flexbox

Learn to arrange elements with CSS Flexbox, control alignment and spacing, wrap items onto new lines, and adjust how items grow and shrink. By the end, you will build and check a responsive card layout in your own browser using a single HTML file.

  • Level: Beginner
  • Duration: approx. 30 min
  • 8 steps
Getting Started with CSS Flexbox

What you will go through

  1. Step 1 of 8 4 min Create Your First Flex Container Turn a normal card section into a spaced Flexbox row and identify the direct children that participate in the layout.
  2. Step 2 of 8 3 min Understand the Two Axes Determine the main and cross axes for row and column Flexbox layouts before choosing alignment properties.
  3. Step 3 of 8 4 min Distribute Space Along the Main Axis Use justify-content to position a card group or distribute remaining free space along the main axis, while keeping a fixed gap distinct from distributed space.
  4. Step 4 of 8 4 min Align Items Across the Main Axis Control flex-item placement on the cross axis with align-items, including stretch and two-axis centering.
  5. Step 5 of 8 3 min Let Cards Wrap onto New Lines Enable a fixed-width card row to form additional flex lines as the available width decreases.
  6. Step 6 of 8 4 min Set Starting Sizes and Share Extra Space Turn a 12rem card basis into flexible card sizing by using flex-grow to share positive free space.
  7. Step 7 of 8 5 min Control Shrinking and Read the Flex Shorthand Learn how flex-shrink, the complete three-value flex shorthand, wrapping, and content constraints affect narrow card layouts.
  8. Step 8 of 8 5 min Build and Check a Responsive Card Layout Complete and verify a responsive Flexbox card list locally, then diagnose and explain its wide and narrow behavior.

Video Courses

Courses related to this topic

See all video courses

Download the App now to have access to + 5000 free courses, exercises, certificates and lots of content without paying anything!

  • 100% free online courses from start to finish

    Thousands of online courses in video, ebooks and audiobooks.

  • More than 60 thousand free exercises

    To test your knowledge during online courses

  • Valid free Digital Certificate with QR Code

    Generated directly from your cell phone's photo gallery and sent to your email

Cursa app on the ebook screen, the video course screen and the course exercises screen, plus the course completion certificate