tags:

views:

45

answers:

1

Hello! I've been trying to make an image resize as you resize the window of the browser. It works in all but Internet explorer. I was requested to do this without external sheets.

<html xmlns="http://www.w3.org/1999/xhtml" style="height: 100%; margin:0; padding:0;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tidsaxel</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<link href="dstyle.css" rel="stylesheet" type="text/css" />
</head>

<body  style="height: 100%; margin:0;">

<table cellpadding="10" height="100%" width="100%" style="margin:0;">
<tr>
  <td rowspan="20" height="100%" style="margin:0;">
  <img src="pil.png" height="100%" width="48" />
  </td>
  <td class="Rubrik">Tidsaxel för krav, program, granskning och beslut</td>
</tr>
<tr>
  <td>Sverige satsar på utveckling av kärnkraft  (1945). Kärnavfallet betraktas inte som något problem.</td>
</tr>
And then it goes on with 20 more rows, I don't think it's nessessary to print them all.
</body>
</html>

The picture doesn't even take up 100% of the height to begin with, and when I resize the window it just gets smaller. Is there a way to fix this? I've read that it's possible with javascript, but I haven't found a solution. It's IE 7 and IE 8 that I've tried on.

A: 

In the table, set cellpadding="0" cellspacing="0". But this affects the content area as well. You might want to look into designing your site with DIVs instead.

You might want to look into a CSS solution:

<style type="text/css">
  body {
    background-image:url(background.png);
    background-repeat:repeat-y;
  }
</style>
Gert G
The resizing still didn't work. The image is an arrow, so it can't be repeated. I've been thinking about solving it with DIVs, but I thought tables would be easier. Do you think the resizing will work better with DIVs?
Toxid
I tried your code in IE 8 and IE 6 and it flexes. IE 6 has some other issues though, but still. Designing with `DIV` tags is the modern way of designing a site (it also makes your site more accessible to impaired users). You can stretch an image within a `DIV`. E.g. http://stackoverflow.com/questions/41198/css-getting-image-to-stretch-a-div
Gert G
It flexes for me too, but I want the image to adjust its height to the tables height. Now it takes the height from the window in internet explorer.
Toxid
Remove `height="100%"` from the table.
Gert G
It stops flexing if I remove the height from the table.
Toxid
It still flexes for me after removing the height from the `TABLE` tag. You'll just remove it from the `TABLE` tag, not from the `TD` tag. I.e. `<table cellpadding="10" width="100%" style="margin:0;">`
Gert G
I had the wrong doctype. I didn't know what doctype was really so I excluded that tag when I copied my html document. It works as expected now. Thanks for your support
Toxid
No problem. I'm glad you figured it out. :)
Gert G