|
Posted by dorayme on 12/06/07 02:52
In article
<de8f9391-398d-487e-a69d-56180eec9928@s36g2000prg.googlegroups.co
m>,
showandbeshown@gmail.com wrote:
> Hi,
>
> I use xhtml and I need to create a simple table which consists of 2
> columns and 1 row. The firs column of the table will contain some text
> and the second one an image. The width of the both columns is fixed
> and the height of the row is defined by the amount of the text in the
> first column. I would like my image adjusts the hight of the row (i.e.
> automatically stretches if it is needed).
>
> Is that possible to do within xhtml? I now that I can set the height
> of the image explicitly. I need to do something like height=100%. But
> it seems to be not supported in xhtml.
>
> Thank you in advance.
Amazingly:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Fit to cell</title>
<style type="text/css">
* {margin: 0; padding: 0;}
img {
display: block;
width: 10em;
height: 100%;
}
td {
width: 10em;
padding: 0;
border: 0px solid #000;
}
table {border-collapse: collapse;}
</style>
</head>
<body>
<table cellspacing="0"><tbody><tr>
<td>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Pellentesque augue.Lorem ipsum dolorLorem ipsum dolor sit amet,
consectetuer adipiscing elit. Pellentesque augue.Lorem ipsum
dolorLorem ipsum dolor sit amet, consectetuer adipiscing elit.
Pellentesque augue.Lorem ipsum dolor </td>
<td><img src="stretch.jpg" alt="" /></td>
</tr></tbody></table>
</body>
</html>
works, or at least gives the illusion, only in Safari 2.0.4 on a
Mac.
I think you will really require scripting for the img to reliably
get the height of the left cell depending on the user font size
etc...
--
dorayme
Navigation:
[Reply to this message]
|