As the content of td increases, the height of th also increases. How can we ensure a fixed height for th.
This is the HTML code:
<table id="depts">
<tr>
<th>Topic Title</th>
<th><a href="create.php?id=1">ADD TOPIC</a></th>
<th>Posted By</th>
</tr>
<tr>
<td colspan="2">Lorem ipsum dolor sit amet, consectetuer.Lorem ipsum dolor sit amet, consectetuerLorem ipsum dolor sit amet, consectetuer</td>
<td>Lorem ipsum </td>
</tr>
<tr>
<td colspan="2">Lorem ipsum dolor sit amet, consectetuer </td>
<td>Lorem ipsum </td>
</tr>
<td colspan="2">Lorem ipsum dolor sit amet, consectetuer </td>
<td>Lorem ipsum </td>
<tr>
<td colspan="2">Lorem ipsum dolor sit amet, consectetuer </td>
<td>Lorem ipsum </td>
</tr>
</table>
Here is the CSS code:
#depts {
width: 500px;
border-spacing: 0;
}
#depts a {
text-decoration: none;
color: white;
background-color: blue;
padding: 10px;
}
#depts th {
border-top: 1px solid black;
background-color: #009688;
text-align: left;
color: white;
padding: 5px;
}
#depts th:first-child {
border-left: 1px solid black;
border-top-left-radius: 5px;
}
#depts th:last-child {
border-right: 1px solid black;
border-top-right-radius: 5px;
}
#depts td {
border: 1px solid black;
}
When the content in td spans only one line, the output looks like this: https://i.sstatic.net/5hK64.png
However, when there are multiple lines of content in td, the output changes to: https://i.sstatic.net/e7jzf.png
The desired output should look like this:
https://i.sstatic.net/t45HN.png