- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>align-content: stretch and align-items</title>
<link href="course.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body class="house">
<div class="room room-1">
<div class="rug simba"></div>
<div class="rug rudolf"></div>
<div class="rug muffin"></div>
<div class="rug massimo"></div>
</div>
<div class="room room-2">
<div class="rug simba"></div>
<div class="rug rudolf"></div>
<div class="rug muffin"></div>
<div class="rug massimo"></div>
</div>
</body>
</html>
CSS
.room {
display: flex;
flex-wrap: wrap;
height: 150px;
}
.rug {
min-height: 20px;
width: 80px;
}
.room-1 {
align-content: stretch;
align-items: stretch;
}
.room-2 {
align-content: stretch;
align-items: stretch;
}
.room-2 .rug {
width: 80px;
}
You’ve gone to a different page
Goalscompleted
0
- Assign
.rug
inside.room-2
a width of120px
so that two rows are displayed. - Then set
align-items
for both container rooms at the start of the axis, - the middle of the axis,
- and the end of the axis.
Comments