- index.html
- style.css
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Overlaying grid items and the z-index property</title>
<link href="world.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body class="world">
<div class="land land--guided">
<div class="element element--grass">Grass</div>
<div class="element element--water">Water</div>
<div class="element element--rocks">Rocks</div>
</div>
</body>
</html>
CSS
.land {
display: grid;
grid-template-columns: 125px 125px 125px 125px;
grid-template-rows: 125px 125px 125px 125px;
}
.element--grass {
grid-row-start: 1;
grid-row-end: -1;
grid-column-start: 1;
grid-column-end: -1;
}
.element--water {
grid-row-start: 2;
grid-row-end: 4;
grid-column-start: 1;
grid-column-end: 4;
}
.element--rocks {
grid-row-start: 1;
grid-row-end: -1;
grid-column-start: 2;
grid-column-end: 3;
}
You’ve gone to a different page
Goalscompleted
0
- Assign a
z-index
with a value of1
to the.element--water
block, - then configure the
.element--grass
to have a value of2
, - and finally assign a value of
2
to the.element--rocks
block.
Comments