Skip to content
Justice Tech School

Flex Container Properties

flex-direction picks the main axis: row, row-reverse, column or column-reverse. flex-wrap: wrap lets items drop onto new lines. justify-content takes values like flex-start, center, space-between and space-around, and align-items takes stretch, center, flex-start and flex-end.

gap adds consistent space between items. align-content positions wrapped lines as a group.

Example
<style>
  .col { display: flex; flex-direction: column; gap: 8px; width: 180px; }
  .wrap { display: flex; flex-wrap: wrap; gap: 8px; width: 240px; margin-top: 12px; justify-content: center; }
  .col div, .wrap div { background: #fed7aa; padding: 10px; border-radius: 6px; }
  .wrap div { width: 70px; text-align: center; }
</style>
<div class="col"><div>Top</div><div>Middle</div><div>Bottom</div></div>
<div class="wrap"><div>1</div><div>2</div><div>3</div><div>4</div><div>5</div></div>

Exercise

Stack the flex items vertically.

.menu {
  display: flex;
  flex-direction: ;
}

Quiz Test

Which property lets flex items move onto a new line?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.