So I have the following scenario where i have a list (can be anything else, i don't really care) that has to have the same spacing between them(green lines) and the same spacing at the beginning and end (red arrows). All this without the container having a fixed position, so if I resize and/add more elements they should still span properly.
I have created a pen with what i "achieved" so far.
This is my code so far:
ul{
width: 90%;
border: 1px solid black;
}
li{
display: inline-block;
margin: 0 100px;
border:1px solid orangered;
}
li:first-child{
margin-left: 20px;
}
li:last-child{
margin-right: 20px;
}
I have also tried with display:grid, they fit properly in the red margins, but don't span equal spacing in between them.
Can this be achieved without the use of JS?