css - 设置 div 的高度,使其延伸到页面的最后,仅使用 css?

标签 css

有没有办法只使用 CSS 设置 div 的高度,这样它就会填充页面高度的提示?

我对网页(客户的自定义框架)的控制非常有限,无法更改任何 html 或使用 javascript。 基本上我有一个文本框,我可以在其中编写 CSS,仅此而已。

此外,我不能进行根本性的更改(例如引入 flex 或类似的东西),因为它会破坏页面/站点。 该网站不使用任何媒体查询或定义视口(viewport)或类似的东西。他们基本上使用 HTML 3.2。它是一个 ASP.NET WebForms 站点,其核心部分构建于 2002 年至 2005 年左右。

...
<body>
    ...

    <div id="rowContainer"> <!-- This is the div that needs to go all the way down to the very end 
                of the entire page. 
                (NOTE: NOT the end of the visible part of the page) -->

        <!-- child elements consist of hierarchy of divs 
              (but are row based, the content of a "row" is undefined), 
              which use a mixture of relative, absolute and fixed positioning. 
             They are dynamically generated and they are "undefined", 
              so no assumptions can be made about the child nodes -->

        <div css="row" > ... </div> <!-- These child divs might all be 
                                          absolutely positioned -->
        <div css="row" > ... </div>
        <div css="row" > <!-- row content is undefined and can change at any time --> </div>
        <div css="row" > ... </div>
    </div> <!-- There are no other visible elements after the "rowContainer" -->
</body>

最佳答案

使用

#rowContainer{
       height:100vh;
}

关于css - 设置 div 的高度,使其延伸到页面的最后,仅使用 css?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56987614/

相关文章:

css - Bootstrap 背景大小覆盖未满

Jquery $(this) 不工作

css - 使用 CSS3 插入边框半径

html - 如何以某种方式使不同尺寸的盒子彼此相邻

html - 强制 html 输入显示内联按钮

javascript - 如何禁用点击、 Angular 自定义动画?

html - 为什么我的背景图片在 IE 中不显示,但在其他所有浏览器中都能正常显示?

css - 以无序列表中的一个元素为目标,给它一个不同的 a :hover property than the others

jquery - 如何使用 jquery waypoint 显示两个 id 之间的隐藏 div

css - 从 3.1 回来后发布 loading rails 3(服务器)