【问题标题】:Fluid height in Internet explorerInternet Explorer 中的流体高度
【发布时间】:2010-06-22 05:44:04
【问题描述】:

我一直在尝试在您调整浏览器窗口大小时调整图像大小。它适用于除 Internet Explorer 之外的所有应用程序。我被要求在没有外部工作表的情况下执行此操作。

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

图片甚至没有占用 100% 的高度,当我调整窗口大小时,它只会变小。有没有办法来解决这个问题?我已经读过使用 javascript 是可能的,但我还没有找到解决方案。我试过的是 IE 7 和 IE 8。

【问题讨论】:

    标签: html


    【解决方案1】:

    在表格中,设置cellpadding="0" cellspacing="0"。但这也会影响内容区域。您可能想考虑使用 DIVs 来设计您的网站。

    您可能想研究 CSS 解决方案:

    <style type="text/css">
      body {
        background-image:url(background.png);
        background-repeat:repeat-y;
      }
    </style>
    

    【讨论】:

    • 调整大小仍然无效。图像是一个箭头,所以不能重复。我一直在考虑用 DIV 解决它,但我认为表格会更容易。您认为调整大小会更好地与 DIV 配合使用吗?
    • 我在 IE 8 和 IE 6 中尝试了你的代码,它可以灵活使用。 IE 6 虽然还有一些其他问题,但仍然存在。使用DIV 标签进行设计是设计网站的现代方式(它还可以让受损用户更容易访问您的网站)。您可以在DIV 中拉伸图像。例如。 stackoverflow.com/questions/41198/…
    • 它也适合我,但我希望图像将其高度调整为桌子高度。现在它从 Internet Explorer 中的窗口获取高度。
    • 从表中删除height="100%"
    • 如果我从桌子上移开高度,它会停止弯曲。
    猜你喜欢
    • 1970-01-01
    • 2016-05-26
    • 2012-01-14
    • 2013-05-24
    • 1970-01-01
    • 2011-05-03
    • 2011-04-02
    • 2011-06-12
    • 1970-01-01
    相关资源
    最近更新 更多