I've just started programming in HTML and can't seem to get this right. I want to center the text in a table, and although I've managed to do it already with a simple HTML page, some problems arise when I want to take things to the next level (which given my little experience with HTML is still quite low).
This is my table:
<table id="Passo1" style="border:5px solid rgba(0, 0, 0, 0.7);border-radius: 10px; background-color:rgba(0, 0, 0, 0.5); text-shadow:0.5px black; color: white" width="400px" class="send">
<th colspan="20px" class="centra_crl"><font size="20px"> Enviar relatório </font></th>
</tr>
<tr>
<td class="centra_crl"> A enviar o relatório do carro para a sua oficina... </td>
</tr>
<tr></tr>
</table>
I want my table to start hidden. For that I use:
document.getElementById("Passo1").style.display="none";
And the class "centra_crl" is:
.centra_crl{
text-align: center;
}
If I don't hide the table when the page is loaded, everything is fine. All the text is placed in the center. The problem is that when I start it hidden and then show it, the text seems to lose the "center" property, showing up placed to the left. Also, what's strange is that if I replace the text later with this
function sendReport2(){
var el = document.getElementById('Passo1');
el.rows[1].cells[0].innerHTML = "Concluído! Verifique no calendário a data da sua próxima visita.";
}
both the th and the td appear in the correct position. It seems like the center property isn't doing anything to the table when I show it.
Do you guys have any idea of what could be the problem? I suspect it might be a really stupid thing, but I can't seem to figure it out.
I apologize in advance if I didn't write this post correctly. I'm not a regular here and always get confused with the spacing.
Thanks!