Information about cookies on this page

Our website uses cookies to ensure the functionality of the website, to collect and analyze information about the performance and usage of the website. Privacy Policy

  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in
  
  • Courses
    • Discord
    • Twitter
    • Linkedin
    • Facebook
    • Instagram
  • Pricing
  • English
  • Čeština
  • Deutsch
  • Русский
Sign inStart free
  • Courses
  • Pricing

Community

Sign in

Row or Column

Next are the three steps in the How to Adopt section. The list with them (the ol element) is a flex container with the classes flex gap-6, so the steps stand side by side in a row. On a phone, each step is squeezed into a narrow column with a word or two on each line.

On a phone, the steps should be one under another, and from a tablet up, side by side. You know the class flex-col from the lesson Flexbox, Grid and Position: it's flex-direction: column. Its opposite is flex-row, flex-direction: row, which a flex container has by default. Mobile first, the steps are a column first, and from md: up, a row:

<ol class="flex flex-col md:flex-row">

The pair flex-col md:flex-row is one of the most common in Tailwind. You'll use it for anything that stands side by side on a computer and one under another on a phone: a picture next to a text, a menu next to the content, a field next to its button.

The gap set by gap-6 applies in both directions: between the steps in a row as well as in a column.

Instructions

  1. 1

    Add the class flex-col to the list with the steps (ol). Now the steps are one under another at every width.

  2. 2

    Add the class md:flex-row to the same list. Switch the preview to 768 px: the steps are side by side again, and at 375 px, they stay in a column.

Back

3/7

  1. 1. Mobile First
  2. 2. Breakpoints
  3. 3. Row or Column
  4. 4. Hiding and Showing
  5. 5. Spacing for Each Width
  6. 6. Content Width on Big Screens
  7. 7. Summary
Next

Try it yourself

Do this exercise right here in your browser. No account needed.