I want to create even spacing between my ul list: New Upload and Share. See example below.
I use justify-items: space-between among other variations to try to evenly distribute my ul items but with no obvious effect. I do not understand as the container appears to have space to redistribute the grids along the inline axis. So why isn't it working?
Update: I see that the actual problem is that the ul isn't spanning to the right end of the column, therefore, it is confined to the second column only.
* {
list-style-type: none;
margin: 0;
padding: 0;
}
div,
li {
border: 1px solid rgb(142, 28, 47);
}
.header {
display: grid;
grid-template-columns: 5fr 1fr 1fr;
}
ul {
grid-template-columns: 2 / 4;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
justify-content: space-between;
}
<div class="header">
<div class="Search">Search</div>
<div class="Alert">Alert</div>
<div class="User Info">User Info</div>
<div class="Intro">Hi There</div>
<ul>
<li>New</li>
<li>Upload</li>
<li>Share</li>
</ul>
</div>
justify-items: center?space-betweenisn't a value forjustify-items. See the documentation - justify-itemsjustify-content: space-between. But the same documentation (see the comment above) says that it is applicable to a flex container you're not using.