Is there a way to create a table that can adjust its rows and columns based on the container width or when resized? https://i.sstatic.net/xeZjl.png
https://i.sstatic.net/kdpJC.png I attempted to use grid-gap in the background, but it resulted in empty red squares when there weren't enough elements in a row. https://jsbin.com/patokutara/1/edit?html,output
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
grid-auto-rows: 100px;
grid-gap: 10px;
background: red;
width: 100%;
height: 100%;
}
.grid__item {
display: flex;
justify-content: center;
align-items: center;
background-color: green;
}
<div class="grid">
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
<div class="grid__item"></div>
</div>
I also tried using outline+gap+border but couldn't achieve the beautiful border-radius shown in the image above.
How can I create a responsive table using grid?
The table should adjust its rows/columns based on the width of the container.
The elements should adjust their width slightly if there is extra space in a row.
The table borders should have a border-radius.
The borders should be collapsed.