Как сделать адаптивную высоту ячейки в таблице
Объясните пожалуйста почему не работает height?
.wrapper {
display: flex;
height 400px;
border: 1px solid red;
}
table {
width: 100%;
height: 100%;
border: 1px solid #000;
}
table tr td {
border: 1px solid #000;
}
table tr:nth-child(1) td {
height: 100%;
}
table tr:nth-child(2) td {
height: 40px;
}
table tr:nth-child(3) td {
height: 40px;
}
<div class="wrapper">
<table>
<tr>
<td>TOP</td>
</tr>
<tr>
<td>CENTER</td>
</tr>
<tr>
<td>BOTTOM</td>
</tr>
</table>
</div>
Ответы (1 шт):
Автор решения: UModeL
→ Ссылка
Всё бы работало хорошо, если не торопиться, быть чуть внимательнее. Просто забыли двоеточие.
.wrapper {
display: flex;
height: 400px;
border: 1px solid red;
}
table {
width: 100%;
height: 100%;
border: 1px solid #000;
}
table tr td {
border: 1px solid #000;
}
table tr:nth-child(1) td {
height: 100%;
}
table tr:nth-child(2) td {
height: 40px;
}
table tr:nth-child(3) td {
height: 40px;
}
<div class="wrapper">
<table>
<tr>
<td>TOP</td>
</tr>
<tr>
<td>CENTER</td>
</tr>
<tr>
<td>BOTTOM</td>
</tr>
</table>
</div>