I am new to using CSS Grid. I have laid out a simple page with a grid layout and three divs. I set the grid (see the ".grid" class in the css code) to 100vh and 100vw, but when I view this in Firefox (version 56) it puts both vertical and horizontal scroll bars on the right and bottom, and the grid does not, in fact, fill the entire view screen.
Here is the html code:
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Welcome to Project</title>
<link href="css/main.css" rel="stylesheet" type="text/css">
</head>
<body class="site">
<div class="grid">
<!-- ______________ -->
<div class="a">
<div class="a_left">
<div>Logo for Project</div>
<div class="topnav">
<a class="active" href="#home">Home</a>
<a href="#news">News</a>
<a href="#contact">Contact</a>
<a href="#about">About</a>
</div>
</div>
</div>
<!-- ______________ -->
<div class="b">This is grid-template-row b</div>
<div class="c">This is grid-template-row c</div>
</div>
<!-- ______________ -->
</body>
</html>
Here is the css code:
.grid {
display: grid;
grid-template-rows: 10% 35% 55%;
width: 100vw;
height: 100vh;
}
.grid > * {
background-color: darkgray;
color: white;
padding: 2em;
}
.a{
display: grid;
font-family: sans-serif;
color: green;
font-size: 16pt;
}
.a_left{
display: flex;
text-align: left;
vertical-align: left;
flex-wrap: nowrap;
justify-content: space-between;
}
.a_right{
display: flex;
height: 100%;
flex-wrap: nowrap;
justify-content: right;
vertical-align: right;
}
.b{
display: grid;
font-family: sans-serif;
color: blue;
font-size: 16pt;
}
.c{
display: grid;
font-family: sans-serif;
color: black;
font-size: 16pt;
}
li {
display: inline;
}
site-nav{
margin-top: 0px;
}
.topnav {
align-content: right;
justify-content: center;
overflow: hidden;
background-color: #333;
height: 100%
}
.topnav a {
float: left;
color: #f2f2f2;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #4CAF50;
color: white;
}
.site{
max-width: none;
display: grid;
}
What else do I have to do to eliminate the scroll bars and have the grid fill the entire viewport?
Thanks for any help on this.