MySQL Forums
Forum List  »  PHP

Re: Aligning HTML table columns in PHP
Posted by: Barry Galbraith
Date: January 18, 2022 05:20PM

One way, with inline style.
<table id="traffic">
<tr>
<td style="text-align: left;"><?php echo $address; ?></td>
<td style="text-align: left;"><?php echo $city; ?></td>
<td style="text-align: left;"><?php echo $state; ?></td>
<td style="text-align: left;"><?php echo $zipcode; ?></td>
<td style="text-align: left;"><?php echo $longitude; ?></td>
<td style="text-align: left;"><?php echo $latitude; ?></td>
</tr>


The preferred way, with style class. The style definition would normally go in the <head> section of the document, or in a linked external stylesheet.

<style>
.la{
text-align:left;
}
</style>
<table id="traffic">
<tr>
<td class="la"><?php echo $address; ?></td>
<td class="la"><?php echo $city; ?></td>
<td class="la"><?php echo $state; ?></td>
<td class="la"><?php echo $zipcode; ?></td>
<td class="la"><?php echo $longitude; ?></td>
<td class="la"><?php echo $latitude; ?></td>
</tr>

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Aligning HTML table columns in PHP
January 18, 2022 05:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.