Jump to content

HTML Formatting


PC Nerd

Recommended Posts

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>";
}

Link to comment
https://forums.phpfreaks.com/topic/37017-html-formatting/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176730
Share on other sites

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>';
}

Link to comment
https://forums.phpfreaks.com/topic/37017-html-formatting/#findComment-176787
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.