Is there an innovative and efficient method to align elements from the bottom left corner to the top right corner?
I have attempted using display: grid, but it is too rigid with fixed columns and a limit of 10 items. I am in search of a clever solution that can work seamlessly with multiple columns and rows of elements.
.cart {
border: 5px solid;
padding: 8px;
width: 240px;
height: 200px;
display: flex;
align-items: flex-end;
}
.box {
background-color: lightgray;
padding: 4px;
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 8px;
grid-template-areas: "box6 box7 box8 box9 box10" "box1 box2 box3 box4 box5";
}
.egg {
width: 40px;
aspect-ratio: 3 / 4;
background-color: sandybrown;
border-radius: 100% 100% 100% 100% / 120% 120% 80% 80%;
box-shadow: inset -4px -8px 20px brown;
font-family: sans-serif;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
}
.egg:nth-child(1) {
grid-area: box1;
}
.egg:nth-child(2) {
grid-area: box2;
}
.egg:nth-child(3) {
grid-area: box3;
}
.egg:nth-child(4) {
grid-area: box4;
}
.egg:nth-child(5) {
grid-area: box5;
}
.egg:nth-child(6) {
grid-area: box6;
}
.egg:nth-child(7) {
grid-area: box7;
}
.egg:nth-child(8) {
grid-area: box8;
}
.egg:nth-child(9) {
grid-area: box9;
}
.egg:nth-child(10) {
grid-area: box10;
}
<div class="cart">
<div class="box">
<div class="egg">1</div>
<div class="egg">2</div>
<div class="egg">3</div>
<div class="egg">4</div>
<div class="egg">5</div>
<div class="egg">6</div>
<div class="egg">7</div>
<div class="egg">8</div>
</div>
</div>