Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Estou criando uma tabela e gostaria que ela ocupasse a tela inteira em relação à altura através da propriedade height no html, sem usar css.
Estou fazendo da seguinte forma, mas não está funcionando.
<table width="100%" height="100" border="5">
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td >
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
</table>Amigo, use um arquivo .CSS para melhorar a leitura e arrumação da marcação. No mais verifique se todos os elementos pai da tabela que você criou estão com height: 100%;
O uso de porcentagem é dado relacionado a algo. Por exemplo: 80% por si só , não diz nada... a pergunta é: 80% de que? Se os elementos pai da tabela não tem height definida, é o mesmo de fazer: 100% de indefinido, que é? Indefinido!
Crie um css assim
html {
margin: 0;
padding: 0;
height: 80%;
width: 100%;
}
Tabela
<table width="100%" height="100%" border="5">
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td >
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
<tr height="20%">
<td width="33%" height="20%">
</td>
<td width="33%" height="20%">
</td>
<td width="34%" height="20%">
</td>
</tr>
</table>
A tabela tem que alterar a height e que o html tem uma margem com essa css você retira essa margem. :D
Com CSS, mude o display dela para "inline-block" ou "block".