2

我想显示一个没有滚动条的页面(高度: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>
4

2 回答 2

1

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

  • 可见:溢出没有被剪裁。它呈现在元素的框外。这是默认设置;
  • hidden:溢出的内容被剪掉,其余内容不可见;
  • 滚动:溢出被剪掉,但添加滚动条以查看其余内容;
  • auto:如果溢出被剪裁,则应添加滚动条以查看其余内容。
于 2010-01-27T15:13:10.373 回答
1

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.

于 2010-01-27T12:13:28.697 回答