In my chatroom, users type messages into a textarea, which are then sent to a PHP file. The PHP file wraps the message in HTML and writes it to a file called log.html
, along with the user's username and profile picture.
Previously, my code looked like this:
<div class='msgln'>
<ul>
<li class='float'><img src='$someimg'></li>
<li class='username_chatroom'><b>username</b></li>
<li class='text_chatroom'><span class='text_span'>Random text</span><li>
</ul>
</div>
Would it be better to convert the divs to table td
and tr
for easier formatting?
<tr class='tr_chat'>
<td class='img_chat'><img src='$someimg'></td>
<td class='usr_chat'><b>username</b></td>
<td class='msg_chat'>Text text text</td>
</tr>
When generating the file containing this HTML, should I explicitly close the table or leave it open?
<table>
<tr class='tr_chat'>
<td class='img_chat'><img src='$someimg'></td>
<td class='usr_chat'><b>username</b></td>
<td class='msg_chat'>Text text text</td>
</tr>
So, should I stick with tables for formatting and should I explicitly define the end of a table?