最近我根据一个UI设计,耗时3h快速实现较复杂页面布局,如上图。根据这份UI设计图,实现代码如下,暂不考虑具体细节,先以成型为主:

<!DOCTYPE html>
<html> <style type="text/css"> *{
padding: 0;
margin: 0;
font-size: 62.5%; } li{
list-style:none
} html{
height:100%;
} body{
height:100%;
} </style> <head>
<title>点餐页</title>
</head>
<body> <header style="width:100%;height:14.28%;background:red"></header>
<div style="width:100%;height:71.42%;display:flex;"> <span style="width:85.72%;overflow-y: auto"> <div style="display: flex;flex-direction:column;height: 50rem"> <span style="width: 100%;height:10%;background:black;margin: 0.5rem 0"></span>
<ul style="width: 100%;background:pink;display: flex;flex-wrap:wrap;justify-content:space-between;"> <li style="width: 30%;height: 20rem;margin: 1rem;display: flex;flex-direction: column">
<span style="background:black ;height: 70%"></span>
<span style="height:10%;background:black;margin: 1rem 0"></span>
<span style="height:15%;background:blue;display: flex;justify-content:space-between;align-items: center;">
<span style="font-size: 2rem">123</span>
<button style="width: 25%">+</button>
</span>
</li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li> </span> </div>
<div style="display: flex;flex-direction:column;height: 50rem"> <span style="width: 100%;height:10%;background:green;margin: 0.5rem 0"></span>
<ul style="width: 100%;background:pink;display: flex;flex-wrap:wrap;justify-content:space-between;"> <li style="width: 30%;height: 20rem;margin: 1rem;display: flex;flex-direction: column">
<span style="background:black ;height: 70%"></span>
<span style="height:10%;background:black;margin: 1rem 0"></span>
<span style="height:15%;background:blue;display: flex;justify-content:space-between;align-items: center;">
<span style="font-size: 2rem">123</span>
<button style="width: 25%">+</button>
</span>
</li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li> </ul> </div>
<div style="display: flex;flex-direction:column;height: 50rem"> <span style="width: 100%;height:10%;background:green;margin: 0.5rem 0"></span>
<ul style="width: 100%;background:pink;display: flex;flex-wrap:wrap;justify-content:space-between;"> <li style="width: 30%;height: 20rem;margin: 1rem;display: flex;flex-direction: column">
<span style="background:black ;height: 70%"></span>
<span style="height:10%;background:black;margin: 1rem 0"></span>
<span style="height:15%;background:blue;display: flex;justify-content:space-between;align-items: center;">
<span style="font-size: 2rem">123</span>
<button style="width: 25%">+</button>
</span>
</li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li>
<li style="width: 30%;height: 20rem;background: black;margin: 1rem"></li> </ul> </div> </span>
<span style="width:14.28%;background:blue"></div> </div>
<footer style="width:100%;height:14.28%;display: flex">
<span style="width: 75%;height: 100%">
<div style="display: flex;height: 100%;flex-direction: column;">
<span style="height: 20%;background: green;width: 100%"></span>
<span style="height:80%;width: 100%">
<ul style="width: 100%;height: 100%;display: flex;flex-direction: row;overflow-x: auto;"> <li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li>
<li style="width: 10rem;height: 100%;display: flex;flex-direction: column;margin: 0 0.5rem;flex-shrink:0">
<span style="background:black ;height: 55%;width: 100%"></span>
<span style="height:10%;background:black;margin-top: 0.3rem ;width: 100%"> </span>
<span style="height:10%;background:black;margin: 0.3rem 0;width: 100%"> </span>
<span style="height:15%;background:blue;width: 100%"></span> </li> </ul>
</span>
</div>
</span>
<span style="width: 25%">
<div style="display: flex;flex-direction: column;height: 100%;">
<span style="height: 50%;background: black"></span>
<span style="height: 25%;background:blue"></span>
<span style="height: 25%;background: pink"></span>
</div> </span> </footer> </body>
</html>

效果如图:

flex布局快速成型(原创)的更多相关文章

  1. CSS flex 布局快速入门

    以前已经学过flex了,一直没做笔记,现在做下笔记再回忆下. 首先,flex布局的迷之属性们,如果一知半解,机械记忆的话,那不到半个月基本忘光光.先感受一下这12个flex布局属性,是不是很“迷”人. ...

  2. flex布局帮助你快速实现布局

    flex布局可以帮我们快速布局一些区块,实现你想要的效果,不用再去float,position之类的.我们在布局网页的时候很多时候都是一些特殊布局,flex就能帮我快速去布局,不需要去定位. 任何一个 ...

  3. 【原创】display:flex布局大全

    全都是自己写的 希望大家可以点个赞 谢谢! Html代码(没时间精简 请多包涵) <!DOCTYPE html> <html lang="en"> < ...

  4. css3 深入理解flex布局

    一.简要介绍 css3最喜欢的新属性之一便是flex布局属性,用六个字概括便是简单.方便.快速. flex( flexible box:弹性布局盒模型),是2009年w3c提出的一种可以简洁.快速弹性 ...

  5. 写给 Android 开发的小程序布局指南,Flex 布局!

    一.序 Hi,大家好,我是承香墨影! 最近在做小程序,验证一些方向,开发效率确实很快,就是各种微信的审核有点费劲,但是总归是有办法解决的. 想要开发一款小程序,其实和我们正常写一款 App 类似,你需 ...

  6. 30分钟彻底弄懂flex布局

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由elson发表于云+社区专栏 目前在不考虑IE以及低端安卓机(4.3-)的兼容下,已经可以放心使用flex进行布局了.什么是flex布 ...

  7. CSS魔法堂:Flex布局

    前言  Flex是Flexible Box的缩写,就是「弹性布局」.从2012年已经面世,但由于工作环境的原因一直没有详细了解.最近工作忙到头晕脑胀,是要学点新东西刺激一下大脑,打打鸡血. Flex就 ...

  8. 【Taro】363- 玩转 Taro 跨端之 flex 布局篇

    Taro 是一套遵循 React 语法规范的跨平台开发解决方案,但是目前当我们使用 Taro 的时候,在不同平台上的开发体验还有不一致的地方,所以我们也都期待有一套跨平台统一的解决方案,能够以最小差异 ...

  9. 谈谈flex布局实现水平垂直居中

    我们在这要谈的是用flex布局来实现水平和垂直居中.随着移动互联网的发展,对于网页布局来说要求越来越高,而传统的布局方案对于实现特殊布局非常不方便,比如垂直居中.所以09年,W3C 提出了一种新的方案 ...

随机推荐

  1. 阿里云redis映射到阿里云服务器

    参考文档:https://help.aliyun.com/document_detail/43850.html?spm=a2c4g.11186623.2.3.7yg9VH ECS Windows 篇 ...

  2. Android Studio 使用Toast

    Toast 是Android系统中体重的一种非常好的提醒方式 在程序中可以将很小的一段消息提醒给用户 在一段时间后自动消失,不会占用如何屏幕空间 Button button1=(Button) fin ...

  3. 32.QT-制作最强电压电阻表盘,可以自定义阴影效果,渐变颜色,图标,文字标签等-附带demo程序

    由于上位机需要绘制电压电阻表盘,如下图所示: 后来,在网上找阿找,还是没找到满意的,索性自己来画控件算了,由于第一次画控件,所以花了我2天时间,才画好 效果图如下: 上图的所有颜色(包括滑动的渐变/单 ...

  4. SpringBoot 之集成邮件服务.

    一.前言 Spring Email 抽象的核心是 MailSender 接口,MailSender 的实现能够把 Email 发送给邮件服务器,由邮件服务器实现邮件发送的功能. Spring 自带了一 ...

  5. linux防火墙相关 iptables

    1. root用户查看防火墙状态(非root用户无权限查看) 查看防火墙状态: service iptables status 2.开启和关闭防火墙 //开启防火墙: service iptables ...

  6. js-clickNumCount.html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. select2 插件加载后端数据

    //html <select class="form-group form-control" name="roomId" id="roomLis ...

  8. vue从入门到进阶:过滤器filters(五)

    Vue.js 允许你自定义过滤器,可被用于一些常见的文本格式化.过滤器可以用在两个地方:双花括号插值和 v-bind 表达式 (后者从 2.1.0+ 开始支持).过滤器应该被添加在 JavaScrip ...

  9. 《从零开始学习jQuery》:用jQuery操作元素的属性与样式

    元素属性和Dom属性简介 对于下面这样一个标签元素: <img id='img' src="1.jpg" alt='1' class="imgs"> ...

  10. IIS搭建Web服务器,外网可以访问,但无法加载视频

    错误提示如下: 可能原因: IIS的MIME中未注册MP4.ogg.webm相关类型,导致IIS无法识别 解决方法: 在IIS中注册MP4.ogg.webm类型,以下以MP4为例,ogg和webm以此 ...