PC Nerd Posted February 4, 2007 Share Posted February 4, 2007 hi guys. ive got the following code which is giving all the right ouput and everything, except for the data cells width. im getting a table about 8th of the size i wanted, but its not useing the width percentages is it with my code, or with the html thanks while ($Att_rows = mysqli_fetch_array($curr_page_query)) { echo "<tr>"; echo "<td width = '%15'>".$Att_rows['Rank']."</d> "; echo "<td width = '%15'>".$Att_rows['Resource_1']."</td> "; echo "<td width = '%55'>".$Att_rows['User_Name']."</td> "; echo "<td width = '%15'>".$Att_rows['Points']."</td> "; echo "</tr>"; } Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/ Share on other sites More sharing options...
only one Posted February 4, 2007 Share Posted February 4, 2007 is the table width on 100%? Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176720 Share on other sites More sharing options...
.josh Posted February 4, 2007 Share Posted February 4, 2007 you have </d> instead of </td> moving to html forum. Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176721 Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Author Share Posted February 4, 2007 stilll not working: code as it stands is echo "<tr>"; echo "<td width = '%15'> RANK </td> "; echo "<td width = '%15'> RESOURCES </td> "; echo "<td width = '%55'> USER NAME </td> "; echo "<td width = '%15'> POINTS </td> "; echo "</tr>"; while ($Att_rows = mysqli_fetch_array($curr_page_query)) { echo "<tr>"; echo "<td width = '%15'>".$Att_rows['Rank']."</td> "; echo "<td width = '%15'>".$Att_rows['Resource_1']."</td> "; echo "<td width = '%55'>".$Att_rows['User_Name']."</td> "; echo "<td width = '%15'>".$Att_rows['Points']."</td> "; echo "</tr>"; } the are for spacing of the titles, but dont do much for the acutual table width Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176730 Share on other sites More sharing options...
Tyche Posted February 4, 2007 Share Posted February 4, 2007 % signs come after the value not before on a width attribute use <td width = '15%'> etc Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176738 Share on other sites More sharing options...
wildteen88 Posted February 4, 2007 Share Posted February 4, 2007 Yeah when defining widths as percentages the percent sign goes after the number not before as Tyche says. Also there is no need to define every cells width on each row. Just define the widths for the cells on the first row only. SO this is should be your code now: echo '<tr>'; echo '<th width="15%"> RANK </th>'; echo '<th width="15%"> RESOURCES </th>'; echo '<th width="55%"> USER NAME </th>'; echo '<th width="15%"> POINTS </th>'; echo '</tr>'; while ($Att_rows = mysqli_fetch_array($curr_page_query)) { echo '<tr>'; echo '<td>' . $Att_rows['Rank'] . '</td>'; echo '<td>' . $Att_rows['Resource_1'] . '</td>'; echo '<td>' . $Att_rows['User_Name'] . '</td>'; echo '<td>' . $Att_rows['Points'] . '</td>'; echo '</tr>'; } Quote Link to comment https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.