order
Lesson 13 of 15 in Coddy's CSS Flexbox - The Complete Course course.
The order property defines the priority of a specific flex item.
By default, the flex items are ordered as in the source code, but you can modify this order using the order property.
The order property gets a number as a value, the higher the number, the higher the flex item priority (which appears at the end).
Example,
.item {
order: 5;
}The default value is 0.
Items with the same
orderacts as in the source order.
Challenge
EasyYou are given a flexbox with six flex items, add to the even flex items (2, 4, 6) order property so that the order of the items will be:
1, 3, 5, 2, 4, 6
You can use HTML id and class to select the specific element in CSS.
Try it yourself
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</body>
</html>