- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ordering elements with CSS</title>
<link href="course.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body class="subtle">
<label for="sort">Sort by taste</label>
<input type="checkbox" id="sort" name="sort" class="input-sort">
<ol class="sort-list">
<li><a href="/">Meat</a></li>
<li><a href="/">Fish</a></li>
<li><a href="/">Sour Cream</a></li>
<li><a href="/">Milk</a></li>
<li><a href="/">Cheese</a></li>
</ol>
</body>
</html>
CSS
.sort-list {
}
.input-sort:checked ~ .sort-list {
}
You’ve gone to a different page
Goalscompleted
0
- Assign a flexbox layout to the
.sort-list
block, - and set the direction of flow of the main axis to from top to bottom.
- Set the direction of the flow of the main axis to from bottom to top when the checkbox state
.input-sort
is selected for the.sort-list
block.
Toggle the checkbox to sort the list items.
Comments