height:100%问题在IE7中,在FF中没有

发布于 2024-08-19 04:31:35 字数 1756 浏览 4 评论 0原文

我想显示一个没有滚动条的页面(高度:100%)。我已阅读将此参数添加到 htmlbody 的建议。但它并不像我预期的那样工作。在 FF 中我确实没有看到滚动条。但在 IE7 和 8(标准模式)中,有一个滚动条。在 Quirks 模式下,它按预期工作。请看一下这个:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <!-- saved from url=(0053)http://apptools.com/examples/tables/standardscss.html -->
    <html><head><title>standards compliance mode with css rendering</title>
    <meta content="text/html; charset=iso-8859-1" http-equiv=content-type>
    <meta content=no http-equiv=imagetoolbar>
    <meta name=mssmarttagspreventparsing content=true>
    <style type=text/css>body {
        padding-bottom: 0px; background-color: #fff; margin: 0px; padding-left: 0px; padding-right: 0px; color: #000; padding-top: 0px
    }
    table {
        border-bottom: #008 1px solid; border-left: #008 1px solid; border-top: #008 1px solid; border-right: #008 1px solid
    }
    html {
        height: 100%
    }
    body {
        height: 100%
    }
    .fullheight {
        height:100%
    }
    </style>

    <meta name=generator content="mshtml 8.00.6001.18876"></head>
    <body>
    <table width=450 bgcolor=#ccccff align=center height="100%">
      <tbody>
      <tr>
        <td colspan="2" height="200px">
          <p>paragraph</p>
    </td></tr>
      <tr class="fullheight"><td >
      <p>paragraph</p>
      </td>
      <td>
      <p>paragraph</p>
      </td>
      </tr>


      </tbody></table></body></html>

I want to display a page with no scrollbar (height:100%). I have read suggestions to add this argument to html and body. But it does not work as I expect. In FF indeed I do not see a scrollbar. But in IE7 and 8 (Standards mode) there is a scrollbar. In Quirks mode it works as expected. Please take a look at this:

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
    <!-- saved from url=(0053)http://apptools.com/examples/tables/standardscss.html -->
    <html><head><title>standards compliance mode with css rendering</title>
    <meta content="text/html; charset=iso-8859-1" http-equiv=content-type>
    <meta content=no http-equiv=imagetoolbar>
    <meta name=mssmarttagspreventparsing content=true>
    <style type=text/css>body {
        padding-bottom: 0px; background-color: #fff; margin: 0px; padding-left: 0px; padding-right: 0px; color: #000; padding-top: 0px
    }
    table {
        border-bottom: #008 1px solid; border-left: #008 1px solid; border-top: #008 1px solid; border-right: #008 1px solid
    }
    html {
        height: 100%
    }
    body {
        height: 100%
    }
    .fullheight {
        height:100%
    }
    </style>

    <meta name=generator content="mshtml 8.00.6001.18876"></head>
    <body>
    <table width=450 bgcolor=#ccccff align=center height="100%">
      <tbody>
      <tr>
        <td colspan="2" height="200px">
          <p>paragraph</p>
    </td></tr>
      <tr class="fullheight"><td >
      <p>paragraph</p>
      </td>
      <td>
      <p>paragraph</p>
      </td>
      </tr>


      </tbody></table></body></html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

尹雨沫 2024-08-26 04:31:35

嗯......你所问的问题可能会涉及复杂的领域,但我会从消除代码中的不一致开始。例如:

  • 您的桌子是 100% 高度。
  • 在里面,你有一个 200 像素高的 在一个 里面
  • ,你还有一个 100% 高的第二个 code>

所以你告诉代码 100% + 200px = 100%。这在逻辑上是失败的,尽管有时您可能想以这种方式破解您的代码。

首先,尝试调整属性,使它们能够逻辑地工作,并尝试将代码简化到更加简单,然后从那里开始工作。之后,如果滚动条仍然出现,您可能需要开始调整负边距。这将与您的代码变得如此“亲密”,坦率地说,任何为您提供建议的人都需要清楚地了解您的目标,而不是就单个代码元素提供建议。

Umm... what you're asking can get into complicated territory, but I'd start with eliminating inconsistencies in your code. For example:

  • Your table is 100% height.
  • Inside, you have a 200px high <td> inside one <tr>
  • Inside, you also have a 100% high second <tr>

So you're telling the code that 100% + 200px = 100%. That fails logically, although you might want to hack your code that way sometimes.

First, try adjusting the properties so that they work logically and try to reduce your code to greater simplicity, and then work your way up from there. After that, if a scrollbar still appears, you'll probably need to start tweaking with negative margins. This will get so "intimate" with your code that frankly anyone advising you would need a clear sense of your objectives, rather than advising on individual code elements.

始终不够 2024-08-26 04:31:35

如果问题出在滚动条上,您可以使用 CSS“溢出”属性来强制执行以下行为:

  • 可见:溢出不会被剪裁。
    它在元素的框外呈现。
    这是默认的;
  • 隐藏:溢出被剪掉,并且
    其余的内容将是
    无形的;
  • 滚动:溢出被剪掉,但是
    添加滚动条以查看其余部分
    内容;
  • auto:如果溢出被剪裁,
    应添加滚动条以查看
    其余内容。

If the problem is the scrollbar, you can use the CSS "overflow" attribute in order to force the behavior:

  • visible: the overflow is not clipped.
    It renders outside the element's box.
    This is default;
  • hidden: the overflow is clipped, and
    the rest of the content will be
    invisible;
  • scroll: the overflow is clipped, but
    a scroll-bar is added to see the rest
    of the content;
  • auto: if overflow is clipped, a
    scroll-bar should be added to see the
    rest of the content.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文