这是一个基本的插图问题的:
<html><head><style type="text/css">
html {width: 100%; height: 100%; background: red;}
body {width: 100%; height: 100%; background: green;}
.leftbar, .rightbar {height: 100%; background: blue;}
.leftbar {float: left;}
.rightbar {float: right;}
table {width: 100px; height: 800px; background: black; color: white;
margin: 0 auto 0 auto;}
</style></head>
<body>
<ul class="leftbar"><li>one</li><li>two</li></ul>
<ul class="rightbar"><li>alpha</li><li>beta</li></ul>
<table><tbody><tr><td>blah blah</td></tr></tbody></table>
</body>
</html>
我们可以立即看到漂浮的ul
元素的高度为body
其中包含它们,问题是body
没有那么高table
它包含的内容。
我该如何制作body
足够大吗?在这个例子中,我想要leftbar
and rightbar
在滚动允许的范围内一直向下,这样您就永远看不到它们下面的任何间隙。
Remove height: 100%
从你的body
规则 - 这使得主体与视口高度一样高(小于内容高度)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)