When defining grid-template-columns
in the corresponding parent div this is fine.
wrapper {
display:grid;
grid-template-columns: 1fr 1fr 700px;
}
But what if I only want two columns?
If I delete one of the fr
columns, it gets whacked.
So does a grid have a min of fr
units if I am to use this? Go ahead and you will see the 2nd column is no longer 700px.
wrapper {
display:grid;
grid-template-columns: 1fr 700px; /* removing the 1fr defining only 2 columns,
destroys the layout */
}
A simple example of this here: https://codepen.io/theboman/pen/PLRZjB
body {
padding: 0px;
margin: 0px;
}
wrapper {
display: grid;
grid-template-columns: 1fr 1fr 700px; /* remove 1fr above and you will see */
}
header {
grid-column-start: 1;
grid-column-end: 4;
height: 40px;
background-color: grey;
}
nav li {
display: inline-block;
padding: 0px 10px
}
aside {
grid-column-start: 1;
grid-column-end: 3;
background-color: #7fa7e8;
height: 50vh;
}
article {
grid-column-start: 3;
grid-column-end: 4;
background-color: #7ee8cc;
height: 50vh;
}
<wrapper>
<header>
<nav>
<ul>
<li>click here</li>
<li>2nd click here</li>
</ul>
</nav>
</header>
<aside>
Aside - content here
</aside>
<article>
some content goes here
</article>
</wrapper>