简体   繁体   English

如何将iframe和div的高度合并为100%?

[英]How to fit iframe and div in 100% height combined?

I'm having difficult times to find a way to fit an iframe and div both with 100% full height on the page. 我很难找到一种适合iframe和div且页面高度均为100%的方法。 Ideally I need to have a footer menu with 280px height and the iframe div needs to cover the rest of the page. 理想情况下,我需要一个高度为280px的页脚菜单,而iframe div需要覆盖页面的其余部分。

As far as I researched, it will be possible only with jQuery. 据我研究,只有jQuery才有可能。 I tried CSS Flex without success. 我尝试CSS Flex失败。

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <header class="header-flex">

                <div class="map">
                    <h2>One</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error ut.</p>
                </div>

                <div class="footer">
                    <h2>Two</h2>
                    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error ut.</p>
                </div>

            </header>
        </div>
    </div>
</body>
</html>

Any idea? 任何想法?

Thanks 谢谢

Working example with CSS Flexbox: CSS Flexbox的工作示例:

 body, html { min-height: 100%; height: 100%; margin: 0; } .header-flex { display: flex; flex-direction: column; height: 100%; } .map { background: red; flex: 1; } .footer { background: blue; } 
 <header class="header-flex"> <div class="map"> <h2>One</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error ut.</p> </div> <div class="footer"> <h2>Two</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error ut.</p> </div> </header> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM