I'm struggling to make all three rows of my table have the same height. Unfortunately, the row with the icon always ends up taller.
Is there a CSS trick that can automatically set a consistent height for all rows in the table, regardless of whether they contain an icon or not?
<!DOCTYPE html>
<html lang="en" >
<head>
<title>TEST</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<style>
#my_div {
line-height: 0.3;
}
.my_icon {
width: 1em;
height: 1em;
vertical-align: middle;
}
</style>
<div class="container-fluid bg-info" id="my_div">
<table class="table">
<tbody>
<tr class="table-primary row">
<td class="col-sm-2">No Icon in this row. </td>
</tr>
<tr class="table-primary row">
<td class="col-sm-2">Icon Row:
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="css-class my_icon"><path d="M15 3h2a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-2"/><polyline points="8 13 12 9 8 5"/><line x1="12" y1="9" x2="2" y2="9"/></svg>
</td>
</tr>
<tr class="table-primary row">
<td class="col-sm-2">No Icon in this row. </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
#my_div {
line-height: 0.3;
}
.my_icon {
width: 1em;
height: 1em;
vertical-align: middle;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<div class="container-fluid bg-info" id="my_div">
<table class="table">
<tbody>
<tr class="table-primary row">
<td class="col-sm-2">No Icon in this row. </td>
</tr>
<tr class="table-primary row">
<td class="col-sm-2">Icon Row:
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="css-class my_icon"><path d="M15 3h2a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-2"/><polyline points="8 13 12 9 8 5"/><line x1="12" y1="9" x2="2" y2="9"/></svg>
</td>
</tr>
<tr class="table-primary row">
<td class="col-sm-2">No Icon in this row. </td>
</tr>
</tbody>
</table>
</div>