gpt4 book ai didi

html 正文小于其内容

转载 作者:太空狗 更新时间:2023-10-29 13:33:51 24 4
gpt4 key购买 nike

这是一个基本的 illustration问题:

<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>​

我们可以立即看到 float 的 ul 元素和包含它们的 body 一样高,问题是 body 是没有它包含的 table 高。

如何使 body 足够大?在此示例中,我希望 leftbarrightbar 一直向下,只要滚动允许,这样您就永远看不到它们下方的任何间隙。

最佳答案

body 规则中删除 height: 100% - 这使得 body 与视口(viewport)高度(小于内容高度)一样高。

关于html 正文小于其内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9398313/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com