I have inherited a project where someone decided to set the display for a td to flex. One of the consequences of this is that when there are other tds in the row that span multiple lines, the td with display: flex does not stretch to the height of the other tds.
The correct way to fix this (I think) would be to remove the display: flex from the td and have it on an inner div, but I currently only have permissions to modify the CSS, so I'm wondering if there is any way to fix it with CSS only (while preserving the layout within the td as shown in the made-up code snippet below)?
EDIT: The desired layout is to have a left and right side within the td, the right side being a span that is a colored dot. The colored dot needs to always be on the right and top aligned even on a mobile device when the td is very narrow and the left side ends up wrapping.
table td {
border: 1px solid black;
}
td.flex {
display: flex;
justify-content: space-between;
}
span.right {
display: inline-block;
margin-left: 1em;
width: 1em;
border-radius: 50%
}
span.red {
background-color: red;
}
span.green {
background-color: green;
}
<table>
<tbody>
<tr>
<td class="flex"><span>Left </span><span class="right red"> </span></td>
<td>td with<br>multiple rows<br>blah blah blah</td>
</tr>
<tr>
<td class="flex"><span>Left side longer </span><span class="right red"> </span></td>
<td>td with<br>multiple rows<br>blah blah blah</td>
</tr>
<tr>
<td>
<div class="flex"><span>The right way to do it </span><span class="right green"> </span></div>
</td>
<td>td with<br>multiple rows<br>blah blah blah</td>
</tr>
</table>