美文网首页
使用flex解决IOS中fixed定位带来的问题(可适配ipho

使用flex解决IOS中fixed定位带来的问题(可适配ipho

作者: 前端勾魂师 | 来源:发表于2020-07-20 11:39 被阅读0次

参考文章:https://segmentfault.com/a/1190000010510291

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>flex</title>
    <style type="text/css">
        body{
            padding: 0;
            margin: 0;
            -webkit-overflow-scrolling: touch; //有回弹效果
        }
        .container{
            height: calc(100vh - 50px);
            background-color: black;
            display: flex;
            flex-direction: column;
        }
        .header{
            width: 100%;
            height: 100px;
            background-color: #e77c8e;
        }
        .main{
            width: 100%;
            flex: 1;
            overflow-y: auto;
            background-color: #2bae85;
        }
        .footer{
            width: 100%;
            height: 100px;
            background-color: #7a7374;
        }
        #h4500{
            height: 4500px;
            width: 100%;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">header</div>
        <div class="main">
            <div id="h4500">
            </div>
        </div>
        <div class="footer">footer</div>
    </div>
</body>
</html>

相关文章

网友评论

      本文标题:使用flex解决IOS中fixed定位带来的问题(可适配ipho

      本文链接:https://www.haomeiwen.com/subject/zpuekktx.html