In my table setup, I have a parent table with a width of 100% and a child table with a width of 300px. I attempted to center the child table using CSS by setting text-align: center; (https://jsfiddle.net/wrzo7LLb/1/)
<table class="body">
<tr>
<td class="align center"> <!-- CSS text-align: center; -->
<table class="wrapper">
<tr>
<td>
some text
</td>
</tr>
</table>
</td>
</tr>
</table>
Unfortunately, this approach did not work as expected. Later on, I tried using align="center" which did work successfully.(https://jsfiddle.net/wrzo7LLb/)
<table class="body">
<tr>
<td align="center"> <!-- align="center" -->
<table class="wrapper">
<tr>
<td>
some text
</td>
</tr>
</table>
</td>
</tr>
</table>
I am seeking an explanation as to why align="center"
works while text-align: center;
does not.
Although I am aware of the alternative method of using margin: 0 auto;
for centering, it still puzzles me why align="center"
is effective in this case but not the other.