I'm following this tutorial here:
https://www.youtube.com/watch?v=qTGbWfEEnKI
The author included github link to their code, which is here:
https://github.com/designcourse/grid-template-areas-tutorial
I copy here below the code verbatim:
/* main.css */
body, html {
height: 100vh;
}
body {
margin: 0;
display: grid;
grid-template-columns: 100%;
grid-template-rows: repeat(auto, 5);
grid-template-areas:
"sect1"
"sect2"
"sect3"
"main"
"footer";
}
aside {
grid-area: sidebar;
background-color: #007FFF;
}
header {
grid-area: header;
background-color: #91C8FF;
}
section:nth-of-type(1) {
grid-area: sect1;
background-color: #B3D8FD;
}
section:nth-of-type(2) {
grid-area: sect2;
background-color: #5E86AF;
}
section:nth-of-type(3) {
grid-area: sect3;
background-color: #6D9FD2;
}
main {
grid-area: main;
background-color: #7DA9D5;
}
footer {
grid-area: footer;
background-color: #588EC3;
}
@media only screen and (min-width: 768px) {
body {
margin: 0;
display: grid;
grid-template-columns: auto 27% 27% 27%;
grid-template-rows: 8% 30% auto 10%;
grid-template-areas:
"sidebar header header header"
"sidebar sect1 sect2 sect3"
"sidebar main main main"
"sidebar footer footer footer";
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<aside></aside>
<header></header>
<section></section>
<section></section>
<section></section>
<main></main>
<footer></footer>
</body>
</html>
So all I did was try to add html headers into the elements so I could see better where they get mapped:
<body>
<aside><h5>aside</h5></aside>
<header><h5>hdr</h5></header>
<section><h5>s1</h5></section>
<section><h5>s2</h5></section>
<section><h5>s3</h5></section>
<main><h5>main</h5></main>
<footer><h5>ftr</h5></footer>
</body>
Now in the narrow view, a scrollbar appears, and scrolling to the right, in the lower right corner, the header section, which isn't supposed to be there, appears anyway. Same result in Chrome and Edge.
This is the first time I've ever tried using grid, but I did search around S.O. here and can't figure out what I'm doing wrong, or what I'm missing.
