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

Spanning Columns

The news box sits in one cell of the third row, and the cell next to it is empty. It would look much better across the whole width of the grid.

In the CSS course, you stretched a grid item over several columns with grid-column: span 2. In Tailwind, there are these classes:

ClassCSSThe item is...
col-span-2grid-column: span 2 / span 2;two columns wide
col-span-fullgrid-column: 1 / -1;as wide as all the columns
row-span-2grid-row: span 2 / span 2;two rows tall

span 2 / span 2 means the same as span 2: Tailwind just writes it for both the start and the end of the item.

An item can also start or end at a particular grid line: col-start-2 is grid-column-start: 2, and col-end-4 is grid-column-end: 4. The lines are numbered from 1, as you know.

Instructions

  1. 1

    Add the class col-span-2 to the news box (the orange div below the cards). It now spans both columns.

Back

7/11

  1. 1. Display
  2. 2. Flexbox
  3. 3. Justify and Align
  4. 4. Columns
  5. 5. Wrapping and Growing
  6. 6. Grid
  7. 7. Spanning Columns
  8. 8. Centering
  9. 9. Badges on Cards
  10. 10. A Sticky Header
  11. 11. Summary
Next

Try it yourself

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