Jump to content

Do nested tables with percent width/heights conform to the outter table?


5kyy8lu3

Recommended Posts

Ok here's the deal.  I have a table with a white background color with 20px padding with a picture inside it so it looks like a polaroid.  This works great and all except I have the "description" of the picture under the picture.  This works fine until I have a picture with a long description saved to it.  This stretches the table out to fit the text on one single long line.  I can't "break" the test because it's a variable from my database so it's dynamic and changes per picture.  I can't make a table for the description below the picture's table because then I have no way to get its width to match the top table since every picture is a different size.  The only thing I can think of is to put a table WITHIN the picture's table to put the description into so the text breaks on its own affect the size of the table.  If I set the nested table to height="*" width="*" will it conform to the table it's inside?  or will this stretch both tables out to 100% of the screen size?

 

here is the current code:

 

<table cellpadding="0" cellspacing="0">

<tr>
	<td align="center" bgcolor="#FFFFFF">
		<?php echo $_SESSION['logname'] . '_data/' . $_GET['pic'] . '">'; ?>
<br>
<br>
		<b>
			echo $row['description'];
		</b>
	</td>
</tr>
</table>

 

in this screenshot you can see it working properly, the picture is framed with white and gives you that "polaroid picture" look

example.jpg

 

in this picture i purposely put a really long description and look what happens, this is what I'm trying to fix

example2.jpg

 

thanks ahead of time, this is really giving me a headache

Link to comment
Share on other sites

why don't you learn about table-less layouts? despite what you may think they are fairly easy to get to grips with...

 

I have said it before and will do so again... 'spending 2-3 days learning table-less (or css) layouts will be the most beneficial time you'll ever spend in web development'.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.