![](https://img.kancloud.cn/05/b6/05b6f93f924ac7086df7bc3ea806e60d_398x680.png) ``` <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="stylesheet" href="static/css/font-icon.css" /> <title>移动端布局参考方案(以商城为例)</title> <style> /* 初始化 */ * { margin: 0; padding: 0; } a { text-decoration: none; color: #666; } html { /* vw: 可视区宽度,100vw:表示占满100份 */ width: 100vw; height: 100vh; /* 在html中设置字体大小, 给后的rem单位用 */ font-size: 14px; } body { min-width: 360px; background-color: #fff; display: flex; flex-flow: column nowrap; } body > header { background-color: #333; color: white; height: 30px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; position: fixed; width: 95vw; } body > .slider { height: 180px; } body > .slider > img { width: 100%; } /* 主导航区 */ nav { height: 200px; display: flex; /* 变成多行容器 */ flex-flow: row wrap; } nav > div { /* 占宽度四分之一 */ width: 25vw; display: flex; flex-flow: column nowrap; align-items: center; } nav > div > a:first-of-type { text-align: center; } nav > div img { width: 50%; } .hot { color: coral; } .title { font-size: 1.2rem; font-weight: normal; text-align: center; margin-top: 10px; } /* 热销区样式 */ .hot-goods { border: 1px solid #cfcfcf; margin-top: 10px; font-size: 0.8rem; display: flex; flex-flow: row wrap; } .hot-goods img { width: 100%; } .hot-goods > .goods-img { padding: 10px; box-sizing: border-box; flex: 1 0 30vw; display: flex; flex-flow: column nowrap; justify-content: center; } .hot-goods > .goods-img > div { display: flex; justify-content: space-around; } /* 商品列表 */ .list-goods { padding: 10px; box-sizing: border-box; border: 1px solid #cfcfcf; font-size: 0.8rem; margin-top: 10px; display: flex; flex-flow: column nowrap; } .list-goods > .goods-desc { display: flex; margin: 10px 0; } .list-goods img { width: 100%; } .list-goods > .goods-desc > a { padding: 10px; box-sizing: border-box; } .list-goods > .goods-desc > a:hover { color: lightseagreen; } /* 页脚 */ body > footer { color: #666; background-color: #efefef; border-top: 1px solid #ccc; height: 55px; position: fixed; bottom: 0; width: 100vw; display: flex; justify-content: space-around; } body > footer > a { margin-top: 10px; font-size: 0.8rem; display: flex; flex-flow: column nowrap; align-items: center; } body > footer > a > span:first-of-type { font-size: 1.6rem; } </style> </head> <body> <!-- 页眉 --> <header> <a href="">LOGO</a> <span class="iconfont">&#xe61f;</span> </header> <!-- 轮播图 --> <div class="slider"> <img src="static/images/banner.jpg" alt="" /> </div> <!-- 主导航区 --> <nav> <div> <a href=""><img src="static/images/link1.webp" alt="" /></a> <a href="">超市精选</a> </div> <div> <a href=""><img src="static/images/link2.webp" alt="" /></a> <a href="">服装百货</a> </div> <div> <a href=""><img src="static/images/link3.webp" alt="" /></a> <a href="">优惠劵</a> </div> <div> <a href=""><img src="static/images/link4.webp" alt="" /></a> <a href="">超市精选</a> </div> <div> <a href=""><img src="static/images/link1.webp" alt="" /></a> <a href="">超市精选</a> </div> <div> <a href=""><img src="static/images/link2.webp" alt="" /></a> <a href="">服装百货</a> </div> <div> <a href=""><img src="static/images/link3.webp" alt="" /></a> <a href="">优惠劵</a> </div> <div> <a href=""><img src="static/images/link4.webp" alt="" /></a> <a href="">超市精选</a> </div> </nav> <!-- 热销商品 --> <h2 class="title">热销商品<span class="iconfont hot">&#xe60b;</span></h2> <!-- 热销商品 --> <div class="hot-goods"> <div class="goods-img"> <a href=""><img src="static/images/goods1.jpg" alt="" /></a> <p>Apple iPhone X 128G</p> <div> <span>4299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> <div class="goods-img"> <a href=""><img src="static/images/goods1.jpg" alt="" /></a> <p>Apple iPhone X 256G</p> <div> <span>6299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> <div class="goods-img"> <a href=""><img src="static/images/goods1.jpg" alt="" /></a> <p>Apple iPhone X 512G</p> <div> <span>8299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> <div class="goods-img"> <a href=""><img src="static/images/goods2.jpg" alt="" /></a> <p>Apple iPhone X 128G</p> <div> <span>4299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> <div class="goods-img"> <a href=""><img src="static/images/goods2.jpg" alt="" /></a> <p>Apple iPhone X 256G</p> <div> <span>6299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> <div class="goods-img"> <a href=""><img src="static/images/goods2.jpg" alt="" /></a> <p>Apple iPhone X 512G</p> <div> <span>8299&nbsp;元</span> <span class="iconfont hot">&#xe602;</span> </div> </div> </div> <!-- 商品列表 --> <h2 class="title">商品列表<span class="iconfont hot">&#xe64b;</span></h2> <div class="list-goods"> <div class="goods-desc"> <a href=""><img src="static/images/goods4.jpg" alt="" /></a> <a href="" >[白条24期免息]Apple苹果iPhone 11 手机 128G 全网通, 免费领取500元话费, 今天17:00下单,明晨12:00之前送达,7天无理由退货,官方提供售后, 以上都是我瞎编的<span class="iconfont hot" style="vertical-align: middle;" >&#xe675;</span ></a > </div> <div class="goods-desc"> <a href=""><img src="static/images/goods3.jpg" alt="" /></a> <a href="" >[白条24期免息]Apple洗衣机,专业清洗苹果手机, 苹果电脑,iPad,洗好保证不能用, 免费领取500元保险费, 今天17:00下单,明晨12:00之前送达,7天无理由退货,官方提供售后, 以上都是我瞎编的<span class="iconfont hot" style="vertical-align: middle;" >&#xe675;</span ></a > </div> <div class="goods-desc"> <a href=""><img src="static/images/goods5.png" alt="" /></a> <a href="" >[白条24期免息]Apple苹果iPhone 11 手机 128G 全网通, 免费领取500元话费, 今天17:00下单,明晨12:00之前送达,7天无理由退货,官方提供售后, 以上都是我瞎编的<span class="iconfont hot" style="vertical-align: middle;" >&#xe675;</span ></a > </div> <div class="goods-desc"> <a href=""><img src="static/images/goods2.jpg" alt="" /></a> <a href="" >[白条24期免息]华为笔记本MateBook 14 全面屏轻薄性能笔记本电脑 十代酷睿(i5 16G 512G MX250 触控屏 多屏协同)灰, 以上都是我瞎编的<span class="iconfont hot" style="vertical-align: middle;" >&#xe675;</span ></a > </div> </div> <!-- 页脚 --> <footer> <a href=""> <span class="iconfont hot">&#xe60c;</span> <span>首页</span> </a> <a href=""> <span class="iconfont hot">&#xe64c;</span> <span>分类</span> </a> <a href=""> <span class="iconfont hot">&#xe602;</span> <span>购物车</span> </a> <a href=""> <span class="iconfont hot">&#xe65b;</span> <span>未登录</span> </a> </footer> </body> </html> ```