What do you mean it is not applying whitespace? You can see that the left and right most columns have 20px reserved for them, if you check in the dev tool.
I think what you intend to do is to create a left and right margin of 20px. If that is the case, you don't even need to use grid to reserve that space: using horizontal margins of 20px should work:
.nav {
width: calc(100% - 40px);
margin-left: 20px;
margin-right: 20px;
}
See example:
.nav {
/* padding: 1rem 1.75rem 0.1rem 1.75rem;*/
text-align: center;
font-size: 2rem;
display: grid;
width: calc(100% - 40px);
margin-left: 20px;
margin-right: 20px;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-template-areas: "main blog work contact";
/* grid-gap: 20px;*/
}
/*Nav li style removal*/
.nav li {
list-style: none;
padding: 0;
margin: 0;
display: inline;
text-decoration: none;
}
/*Nav link styling*/
ul {
padding: 0;
}
.nav a {
text-decoration: none;
font-family: 'Monoton', cursive;
color: #000;
text-transform: uppercase;
}
#main-link {
grid-area: main;
}
#blog-link {
grid-area: blog;
}
#work-link {
grid-area: work;
}
#contact-link {
grid-area: contact;
}
<nav id="navigation">
<ul class="nav">
<li class="navbutton navhover"><a href="blogs.html" id="main-link">Main</a></li>
<li class="navbutton navhover"><a href="blogs.html" class="currentlink" id="blog-link">Blog</a></li>
<li class="navbutton navhover" id="work-link"><a href="work.html">Work</a></li>
<li class="navbutton navhover" id="contact-link"><a href="contact.html">Contact</a></li>
</ul>
</nav>
Otherwise, you will have to use empty <li></li>
elements in order to reserve that space, based on the grid-template-areas
you've declared:
<ul class="nav">
<li></li>
<li class="navbutton navhover"><a href="blogs.html" id="main-link">Main</a></li>
<li class="navbutton navhover"><a href="blogs.html" class="currentlink" id="blog-link">Blog</a></li>
<li class="navbutton navhover" id="work-link"><a href="work.html">Work</a></li>
<li class="navbutton navhover" id="contact-link"><a href="contact.html">Contact</a></li>
<li></li>
</ul>
See example:
.nav {
/* padding: 1rem 1.75rem 0.1rem 1.75rem;*/
text-align: center;
font-size: 2rem;
display: grid;
width: 100%;
grid-template-columns: 20px 1fr 1fr 1fr 1fr 20px;
grid-template-areas: ". main blog work contact .";
/* grid-gap: 20px;*/
}
/*Nav li style removal*/
.nav li {
list-style: none;
padding: 0;
margin: 0;
display: inline;
text-decoration: none;
}
/*Nav link styling*/
ul {
padding: 0;
}
.nav a {
text-decoration: none;
font-family: 'Monoton', cursive;
color: #000;
text-transform: uppercase;
}
#main-link {
grid-area: main;
}
#blog-link {
grid-area: blog;
}
#work-link {
grid-area: work;
}
#contact-link {
grid-area: contact;
}
<nav id="navigation">
<ul class="nav">
<!-- Unsemantic placeholder :( -->
<li></li>
<li class="navbutton navhover"><a href="blogs.html" id="main-link">Main</a></li>
<li class="navbutton navhover"><a href="blogs.html" class="currentlink" id="blog-link">Blog</a></li>
<li class="navbutton navhover" id="work-link"><a href="work.html">Work</a></li>
<li class="navbutton navhover" id="contact-link"><a href="contact.html">Contact</a></li>
<!-- Unsemantic placeholder :( -->
<li></li>
</ul>
</nav>