我想显示一个没有滚动条的页面(高度: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>
答案 0 :(得分:1)
<td>
<tr>
<tr>
所以你告诉代码100%+ 200px = 100%。这在逻辑上是失败的,尽管你有时可能想以这种方式破解你的代码。
首先,尝试调整属性以便它们以逻辑方式工作,并尝试将代码简化为更简单,然后从那里开始工作。之后,如果仍然出现滚动条,您可能需要开始调整负边距。这将使您的代码变得如此“亲密”,坦率地说,任何建议您的人都需要清楚地了解您的目标,而不是就个别代码元素提出建议。
答案 1 :(得分:1)
如果问题是滚动条,您可以使用CSS“overflow”属性来强制执行此行为: