我想显示一个没有滚动条的页面(高度:100%)。我已阅读将此参数添加到的建议 html身体. 。但它并没有像我预期的那样工作。在 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>

没有正确的解决方案

其他提示

嗯...您所要求的内容可能会涉及复杂的领域,但我会从消除代码中的不一致开始。例如:

  • 你的桌子的高度是 100%。
  • 在里面,你有 200px 高 <td> 里面一 <tr>
  • 里面,你还有一个100%高的秒 <tr>

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

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

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

  • 可见的:溢出不会被剪裁。它在元素的框外呈现。这是默认的;
  • 隐:溢流被剪裁,并且 其余内容将是 无形;
  • 滚动:溢出被剪裁,但 添加了一个滚动条以查看其余部分 内容;
  • 汽车:如果溢出被剪裁,则 应添加滚动条以查看 其余内容。
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top