Jump to content

Help With Table Percent


kalster

Recommended Posts

I have a problem of course :). the table width is not displayed correctly. The collumes (i think i said that correctly) is not displaying at 20%. the width of the table is not displaying correctly. at the last input, the width is not the same as the other width. i hope your understand. thank you. the table is displayed, but the last feild is not at the 20% like the rest.

<table width="100%" border="1">
<form action="event.php" method="post" name="event" id="event">
<tr>
<td width="%20">Crime</td>
<td width="%20">Money</td>
<td width="%20">Chance</td>
<td width="%20">Burglar men</td>

<td width="%20"><input type="submit" value="submit"></td>
</tr>
</form>
</table>

Link to comment
https://forums.phpfreaks.com/topic/270975-help-with-table-percent/
Share on other sites

When you run into issues like this, try going to: http://validator.w3.org/check to see if your code is valid before posting here. I placed your code into the validator (with the doctype reference and full html tags) and received a few errors that may or may not be causing your issue. Here is the snippet that passed validation:

 

<form action="event.php" method="post" name="event" id="event">
<table width="100%" border="1">
<tr>
<td width="%20">Crime</td>
<td width="%20">Money</td>
<td width="%20">Chance</td>
<td width="%20">Burglar men</td>
<td width="%20"><input type="submit" value="submit" /></td>
</tr>
</table>
</form>

 

Your form tag should be outside of your table AND you should have a closing "/" on your input. See if that takes care of your layout issue. And while it isn't a validation issue, you should choose to put the "%" consistently before or after the number to make it easier to view for others - after the number is most widely accepted, but either way, try not to go back and forth like in this example (i.e. 100% and %20).

<table width="100%" border="1">

<form action="event.php" method="post" name="event" id="event">

<tr>

<td width="20%">Crime</td>

<td width="20%">Money</td>

<td width="20%">Chance</td>

<td width="20%">Burglar men</td>

 

<td width="20%"><input type="submit" value="submit"></td>

</tr>

</form>

</table>

My guest is to make submit button width "smaller since its a small button

<table width="96%" border="1">

<form action="event.php" method="post" name="event" id="event">

<tr>

<td width="20%">Crime</td>

<td width="20%">Money</td>

<td width="20%">Chance</td>

<td width="31%">Burglar men</td>

<td width="9%"><input type="submit" value="submit"></td>

</tr>

</form>

</table>

  On 11/25/2012 at 5:11 PM, SocialCloud said:

You are setting your table width to 96% yet it adds up to 100%

Say the table at 96% was 1000px wide. If you set a TD to 20%, it will be 20% of that 96% or 1000px which is a TD with a width of 200px.

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.