I've a button on the right side. If I choose this button, a DIV opens with other elements.
It looks like: [6x][5x][4x][3x][2x][1x][BUTTON]
What I want to achieve is that each element takes the width of the previous one and adds up to 50px.
<details>
<summary>CHA</summary>
<ul>
<li><a href="#">ENG</a></li>
<li><a href="#">FRA</a></li>
<li><a href="#">ATA</a></li>
<li><a href="#">AUT</a></li>
<li><a href="#">BEL</a></li>
<li><a href="#">BRA</a></li>
</ul>
</details>
summary {
position: absolute;
right: 0;
top: 0;
}
ul{
width: 100%;
right: 50px;
position: absolute;
}
ul li {
float: right;
margin-left: 1rem;
}
ul li a,
summary {
color: #fff;
display: flex;
width: 50px;
height: 100%;
justify-content: center;
align-items: center;
}
The problem here is that the element - ul li a dont get the full height. By adding to the ul li a element a position absolute all are at the same position/place.
So I thought I can use the nth-of-type(x) css statement like:
ul li a:nth-of-type(n){
right:calc(50px+n)
}
Or somehow like that - I know that this is not the right syntax. Is it possible, am I thinking wrong, how to?
Here is the PEN: https://codepen.io/User-123456789/pen/MOzdLp