移动端常见布局之流式布局

  • Post author:
  • Post category:其他




移动端常见布局

移动端单独制作

  • 流式布局(百分比布局)
  • flex 弹性布局(强烈推荐)
  • less+rem+媒体查询布局
  • 混合布局

响应式

  • 媒体查询
  • bootstarp



流式布局:

流式布局,就是百分比布局,也称非固定像素布局。

通过盒子的宽度设置成百分比来根据屏幕的宽度来进行伸缩,不受固定像素的限制,内容向两侧填充。

    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        section {
            width: 100%;
            max-width: 980px;
            min-width: 320px;
            margin: 0 auto;
        }
        
        section div {
            float: left;
            width: 50%;
            height: 400px;
        }
        
        section div:nth-child(1) {
            background-color: pink;
        }
        
        section div:nth-child(2) {
            background-color: purple;
        }
    </style>
</head>

<body>
    <section>
        <div></div>
        <div></div>
    </section>
</body>


流式布局方式是移动web开发使用的比较常见的布局方式。



版权声明:本文为zh_hunan原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。