Is there a way to make a table responsive?
I'm looking for a table layout similar to this one:
https://i.sstatic.net/QqwzG.png
The table needs to adjust its column widths to be responsive.
I've heard that using Flexbox might be the best solution, but how do I implement it?
I attempted the following code:
.container {
display: flex;
border: 1px solid black;
}
.column {
display: flex;
flex-direction: column;
border: 1px solid black;
}
.cell {
border: 1px solid black;
padding: 5px;
}
<div class="container">
<div class="column">
<div class="cell"></div> <!-- empty cell -->
<div class="cell">something</div>
<div class="cell">dog</div>
<div class="cell">more dogs</div>
</div>
<div class="column">
<div class="cell">column2 long title</div>
<div class="cell">abc</div>
<div class="cell">a</div>
<div class="cell">aaaaaaa</div>
</div>
<div class="column">
<div class="cell">column 3 tilew</div>
<div class="cell">bbbb</div>
<div class="cell">da</div>
<div class="cell">f</div>
</div>
<div class="column">
<div class="cell">something</div>
<div class="cell">ggggg</div>
<div class="cell">f</div>
<div class="cell">cats</div>
</div>
</div>
I created 4 columns with an equal number of rows, but they don't have the same height. How can I make them uniform?
Also, the first cell in each column needs to be empty.
Thank you for your help!