My goal is to create an HTML table with specific properties:
- The first column should be frozen
- The text on the header row should be wrapped
Although it sounds simple, I am encountering an issue where the height of the first column in the header row is incorrect. It does not match the height of the rest of the row. Here is an example of what I'm dealing with:
tr th {
white-space: pre-wrap !important;
}
tr td {
white-space: nowrap;
}
.first-column {
position: absolute;
width: 140px;
background-color: aliceblue;
white-space: nowrap;
}
.first-column.header {
background-color: red;
}
.second-column {
padding-left: 145px !important;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="first-column header">Aaaaa aaaaa</th>
<th class="second-column">Bbb bbb bbb</th>
<th>Cc cccc</th>
<th>Ddddd dd dd ddddd</th>
<th>E</th>
<th>Ffff</th>
<th>...<!--Duplicate content removed-->