HTML Academy
The align-content property: non-stretch and align-items
Flexbox, part 118/32
Back to the list of tasks
  • 1. The display: flex property, flex item
  • 2. The flex-direction property, main axis
  • 3. The flexbox cross axis
  • 4. The justify-content property, alignment along the main axis
  • 5. The justify-content property: flex-start | flex-end
  • 6. The justify-content property: space-between | space-around
  • 7. The align-items property, alignment along the cross axis
  • 8. The align-items property: flex-start | flex-end
  • 9. The align-items: baseline property
  • 10. The align-self property, or selfish alignment
  • 11. The align-self: baseline property
  • 12. Test: Creating a simple palette
  • 13. The flex-wrap property, wrapping of flex items
  • 14. The flex-wrap property, reverse wrapping
  • 15. The align-content property, alignment of flex container lines
  • 16. The align-content property: stretch and align-items
  • 17. The align-content property: non-stretch and align-items
  • 18. The align-content property, remaining values
  • 19. The order property, the sequence number of the flex item
  • 20. Test: Creating a more complicated palette
  • 21. Perfect centering by assigning margin: auto to the flex item
  • 22. Perfect centering, flex alignment
  • 23. The adaptive horizontal menu, part 1
  • 24. The adaptive horizontal menu, part 2
  • 25. The adaptive horizontal menu, part 3
  • 26. The vertical row of icons
  • 27. The vertical row of icons, part 2
  • 28. The vertical row of icons, part 3
  • 29. Ordering elements with CSS
  • 30. Creating blocks of equal height using a flexbox
  • 31. Test: Complex palettes
  • 32. Summary of “Flexbox, Part 1”
The order property, the sequence number of the flex item
  • Sign up
  • Log in

Loading…
Everything will be ready in few seconds

  • Theory
  • Theory
  • Comments

The align-content property, remaining values

The remaining four values of the align-content property are similar to the values of the justify-content property, only the axis is different:

  • flex-start arranges rows at the start of the cross axis.

  • flex-end arranges rows at the end of the cross axis.

  • space-between evenly distributes the rows along the cross axis. The distances between adjacent rows are the same, but there is no added space at the edges.

  • space-around evenly distributes the rows along the cross axis. The distances between adjacent rows are the same, but the added spaces at the edges are equal to half of the added space between neighboring rows.

Finally, let’s review a short summary.

align-content is a hybrid property. Though the name of the property contains “align”, the function that it performs is closer to arranging and distributing, like the justify-content property, from which it has borrowed two values, space-between and space-around.

The distribution of free space is illustrated by the space-between and space-around values covered here. Still, the property works with rows and not with individual items.

This property borrowed the value stretch from the “alignment” properties, align-items and align-self. For align-content, it is the default value and stretches rows along the cross axis—in height in our row layout.

Comments

  • index.html
  • style.css
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Remaining values of align-content</title> <link href="course.css" rel="stylesheet"> <link href="style.css" rel="stylesheet"> </head> <body class="house"> <div class="room"> <div class="rug simba"></div> <div class="rug rudolf"></div> <div class="rug muffin"></div> <div class="rug massimo"></div> <div class="rug marty"></div> <div class="rug blacky"></div> </div> </body> </html>
CSS
.room { display: flex; flex-wrap: wrap; align-content: stretch; align-items: stretch; } .rug { min-height: 40px; width: 180px; }

What didn’t you like in this task?

Thanks! We’ll fix everything at once!

The code has changed, click “Refresh” or turn autorun on.

You’ve gone to a different page

Click inside the mini-browser to shift the focus onto this window.

100%
Goalscompleted
0
    1. For .room, align the rows at the start of the cross axis,
    2. and at the end of the cross axis,
    3. and apply uniform alignment with no added space along the edges
    4. as well as uniform alignment with added spaces along the edges half the size of those between rows.

    Cookies ∙ Privacy ∙ License Agreement ∙ About ∙ Contacts ∙ © HTML Academy OÜ, 2019−2026

    VISAMastercard

    Log in

    or

    Forgot your password?

    Sign up

    Sign up

    or
    Log in

    Restore access

    Have you forgotten your password or lost access to your profile? Enter your email connected to your profile and we will send you a link to restore access.

    Forgot to connect your email to the profile? Email us and we’ll help.