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

ok well I gave up for now and went a different direction, I left the picture in its own table and put the description below it in its own table, not as cool but it still works i guess, here's a screenie (i'd still love the solution to my problem if anyone has one)

 

example3.jpg

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'.

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.