- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>align-content: no-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: 120px;
}
.room-1 {
align-content: stretch;
align-items: stretch;
}
.room-2 {
align-content: stretch;
align-items: stretch;
}
You’ve gone to a different page
Goalscompleted
0
- For
.room-2
, center-align the rows along the axis. - Then set
align-items
for both container rooms at the start of the axis - as well as the end of the axis.
Comments