Forum Moderators: open

Message Too Old, No Replies

Table with picture and text

Text wrap when resizing the window

         

Adam5000

12:29 pm on Oct 18, 2006 (gmt 0)

10+ Year Member



I'm creating a page with both a picture and text. And what I'd like is to have the picture in the top left corner and text both beside (to the right of) the picture and also below it. I've put the picture and text in a table in a large (800 x 600) window, and adjusted the text beside the picture to end at the bottom of the picture. But when I make the window smaller and the text wraps, it creates a gap below the picture. Below is the code I'm using at this point.

<html>
<head>
<title>PictureText</title>
</head>
<body>
<table>
<tr>
<td align="left" valign="top">
<img src="Picture_one.jpg" width=200px height=200px>
</td>
<td align="left" valign="top" colspan=2>
<p>Text here that is long enough to wrap and fill the area beside the picture</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<p>At least two more lines of text here</p>
</td>
</tr>
</table>
</body>
</html>

What I'd like is, when the window is made smaller, to have the text beside the picture wrap and stay even with the bottom of the picture, with the excess text going below the picture. Help!

Tidal2

12:50 pm on Oct 18, 2006 (gmt 0)

10+ Year Member



What about floating the picture like this -

<html>
<head>
<title>PictureText</title>
</head>
<body>
<table>
<tr>
<td align="left" valign="top">
<img src="Picture_one.jpg" style="float:left;" width=200px height=200px>
<p>
Text here that is long enough to wrap and fill the area beside the picture</p>
<p>
At least two more lines of text here</p>
</td>
</tr>
</table>
</body>
</html>

You could also replace the table with a <div> in this case.

Adam5000

4:59 am on Oct 19, 2006 (gmt 0)

10+ Year Member



You're a genius title. That works fabulous.

Adam5000

5:00 am on Oct 19, 2006 (gmt 0)

10+ Year Member



Oops. I meant Tidal.

Tidal2

7:30 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Glad it worked for you, its whats called an 'inline style' and quite a useful tool when used on a single tag on a page.

Its much more powerful if used as an external style sheet then one external style change can cover multiple tags over many pages. For example to change background colours over a whole site with a single external style sheet change.

When you have time see the 'cascading style sheet' or css forum and look for tutorials in -

[webmasterworld.com...]