Interactive online courses HTML Academy
2026-03-09 12:29 Diff

Another property that we will look at in this chapter is order, which sets the sequence number of the flex item.

The sequence number is an integer, which can be either positive or negative. For example:

.flex-element { order: -1; /* This item is displayed first in the container */ }

By default, the sequence number of the flex items is equal to 0, and the items are sorted in ascending order starting from this value.

This is a very useful property, since it can be used to change the order of flex items in the stream without changing the HTML code.

Let’s try to rearrange the rugs with the cats using the order property.