Ok, I am now starting to use flexbox a bit more, but it is not very logic to me as an old man,
I have an unsorted horizontal list (ul) with +/- 10 items (li) That consist out only 1 row, no word wrap etc. What I want is that the first and the last one are always visible, and the others can have a 'display:none' if there is not enough screen space. The li;s can have different widths on every page. I have now this code, and it sort of works, but a list item is now half visible if the screen or browser is not wide enough. They should go completely not visible, how can I achieve this? I have tried many things ....
ul{
list-style: none;
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap ;
overflow: hidden;
white-space: nowrap;
position: relative
}
ul li{
flex: auto;
display: inline-block;
line-height: 30px;
float: left;
margin-right: 0px;
}
ul li.b{
background:#ccc;
position: absolute;
right: 0
}
ul li a{
display: inline-block;
margin-right: 0px;
padding: 0 10px 0 10px
}
<ul>
<li class="a"><a href="#">fixed</a></li>
<li><a href="#">2 test</a></li>
<li><a href="#">3 test</a></li>
<li><a href="#">4 test</a></li>
<li><a href="#">5 test</a></li>
<li><a href="#">6 test</a></li>
<li><a href="#">7 test</a></li>
<li><a href="#">8 test</a></li>
<li><a href="#">9 test</a></li>
<li class="b"><a href="#">last fixed</a></li>
</ul>