I'm learning HTML & CSS and right now I'm studying about CSS Grid.
I think I'm understanding how CSS Grid works and I've been trying to write a website with a box item positioned in a specific place inside a grid.
I took a screenshot and painted a square on where I'm trying to position container-box item. I've been trying to position it with grid-column and grid-row with now avail.
(That solid black rectangle should be looking at that container-box paint drawing)
Here's my code:
body {
background: #aaa;
}
html,
body,
.header-bar {
height: 100%;
margin: 0;
}
.header-grid {
display: grid;
grid-template: 100px / 1fr 1fr 1fr;
}
.header-bar {
grid-column: 1/4;
background: #ccc;
margin-bottom:
}
.menu-items ul {
margin: 0;
padding: 0;
}
.menu-items li {
list-style: none;
float: left;
margin-right: 10px;
background-color: #aaa;
position: relative;
line-height: 60px;
}
.menu-items {
grid-row: 1/2;
grid-column: 1/2;
float: left;
margin-left: 20px;
margin-top: 18px;
}
.img {
height: 70px;
width: 90px;
float: left;
margin-left: 100px;
margin-top: 10px;
}
.container-box {
background: #000;
width: 18em;
grid-column: 3/4;
grid-row: ;
}
/*float clearfix */
.list-items:after {
content: "";
display: table;
clear: both;
}
.header-bar:after {
content: "";
display: table;
clear: both;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="header-grid">
<header class="header-bar">
<img src="img/shop.png" class="img">
<nav class="menu-items">
<ul class="list-items">
<li>Categories</li>
<li>Gifts</li>
<li>Giveaways</li>
<li>Exclusive</li>
</ul>
</nav>
</header>
</div>
<div class="container-box">
test
</div>
</body>
</html>
Also, if you pick a semantic mistake please let me know.