I have a table with minimum width and variable number of columns. But the first column will always have the same content, container with couple icons stack together.
I need to use display: flex
on the container, but this will stretch it to the full width of column, which will break my layout, please see example bellow:
table {
width: 500px;
background-color: tan;
}
.stack-container {
position: relative;
display: flex; /* This is the troublemaker */
}
.icon1 {
font-size: 22px;
}
.icon2 {
position: absolute;
right: -2px;
bottom: -3px;
}
<table>
<tr>
<td>
<span class="stack-container">
<span class="icon1">A</span>
<span class="icon2">o</span>
</span>
</td>
<td>Two</td>
</tr>
</table>
How to prevent the .stack-container
with display: flex
to stretch to full width of a table cell and make it stretch only to the width of it's content?
Example of what I want to achieve:
Note1: When .stack-container
is display: block
it's stretched as well.
Note2: When .stack-container
is display: inline
, then it's not stretched to the full width of a table cell.