Reordering Flex Items Visually with Flexbox
Flexbox allows you to change the visual order of items without altering the HTML structure by using the order property. By default, all items have order: 0, and you can assign positive or negative values to move items forward or backward along the main axis.
Set the container's display to flex.
Use the order property on individual flex items to define their visual position.
Lower order values appear first, higher values appear later.
You can mix positive, negative, and zero values for precise ordering.
Changing order does not affect the source HTML, preserving accessibility and document structure.
In this example, although Item 3 is last in the HTML, it appears first visually because it has the lowest order value. Flexbox allows you to rearrange items dynamically without touching the HTML.