首页 > 其他 > 详细

flex简单参考实例

时间:2019-05-23 14:09:09      阅读:92      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        .main {
            position: absolute;
            left: 0;
            top: 0;
            background-color: aquamarine;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 100%;
            height: 100%;
        }

        .top {
            height: 60px;
            width:90%;
            background-color: red;
            text-align:center;
        }
        
        .container{
            width: 90%;
            background-color: gray;
            flex: 1; /**占据所有剩余空间**/
            text-align:center;
            display: flex;
        }
        
        .left, .right{
            width:100px;
            background-color:green;
            //flex:1;/**想要3个div均等划分就开放此设置**/
        }
        
        .center{
            flex:1;
        }

        .bottom {
            width: 90%;
            height: 60px;
            background-color: red;
            text-align:center;
        }
    </style>
</head>
<body>
    <div class="main">
        <div class="top">
            top
        </div>

        <div class="container">
          <div class="left">left</div>
          <div class="center">center</div>
          <div class="right">right</div>
        </div>

        <div class="bottom">footer</div>
    </div>
</body>
</html>

技术分享图片

 

flex简单参考实例

原文:https://www.cnblogs.com/itjeff/p/10911380.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!