flex布局快速成型(原创)

最近我根据一个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布局快速成型(原创)的更多相关文章
- CSS flex 布局快速入门
以前已经学过flex了,一直没做笔记,现在做下笔记再回忆下. 首先,flex布局的迷之属性们,如果一知半解,机械记忆的话,那不到半个月基本忘光光.先感受一下这12个flex布局属性,是不是很“迷”人. ...
- flex布局帮助你快速实现布局
flex布局可以帮我们快速布局一些区块,实现你想要的效果,不用再去float,position之类的.我们在布局网页的时候很多时候都是一些特殊布局,flex就能帮我快速去布局,不需要去定位. 任何一个 ...
- 【原创】display:flex布局大全
全都是自己写的 希望大家可以点个赞 谢谢! Html代码(没时间精简 请多包涵) <!DOCTYPE html> <html lang="en"> < ...
- css3 深入理解flex布局
一.简要介绍 css3最喜欢的新属性之一便是flex布局属性,用六个字概括便是简单.方便.快速. flex( flexible box:弹性布局盒模型),是2009年w3c提出的一种可以简洁.快速弹性 ...
- 写给 Android 开发的小程序布局指南,Flex 布局!
一.序 Hi,大家好,我是承香墨影! 最近在做小程序,验证一些方向,开发效率确实很快,就是各种微信的审核有点费劲,但是总归是有办法解决的. 想要开发一款小程序,其实和我们正常写一款 App 类似,你需 ...
- 30分钟彻底弄懂flex布局
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 本文由elson发表于云+社区专栏 目前在不考虑IE以及低端安卓机(4.3-)的兼容下,已经可以放心使用flex进行布局了.什么是flex布 ...
- CSS魔法堂:Flex布局
前言 Flex是Flexible Box的缩写,就是「弹性布局」.从2012年已经面世,但由于工作环境的原因一直没有详细了解.最近工作忙到头晕脑胀,是要学点新东西刺激一下大脑,打打鸡血. Flex就 ...
- 【Taro】363- 玩转 Taro 跨端之 flex 布局篇
Taro 是一套遵循 React 语法规范的跨平台开发解决方案,但是目前当我们使用 Taro 的时候,在不同平台上的开发体验还有不一致的地方,所以我们也都期待有一套跨平台统一的解决方案,能够以最小差异 ...
- 谈谈flex布局实现水平垂直居中
我们在这要谈的是用flex布局来实现水平和垂直居中.随着移动互联网的发展,对于网页布局来说要求越来越高,而传统的布局方案对于实现特殊布局非常不方便,比如垂直居中.所以09年,W3C 提出了一种新的方案 ...
随机推荐
- c# 用户自定义转换
class Program { public string Name; public int Age; public Program(string name ,int age) { Name = na ...
- netty-socketio 概述
netty-socketio 概述 netty-socketio是一个开源的Socket.io服务器端的一个java的实现,它基于Netty框架,可用于服务端推送消息给客户端. 说到服务端推送技术,一 ...
- Hibernate入门(十一)多对多案例
Hibernate多对多案例 1.用户对角色 DROP TABLE IF EXISTS emp_role; DROP TABLE IF EXISTS employee; DROP TABLE IF E ...
- Hibernate入门(十)inverse
双向关联产生多余的SQL语句 /** * 添加一个订单到id为6的客户中 */ @Test public void fun1(){ Session session = HibernateUtils.g ...
- Offer选择与总结
今天是2015.11.23,我估计这也是继高考.保研这些决定与选择之后,又一个比较重大的人生选择.最终选择了去微信支付,按钱来说比最高的offer少五万,其实挺心疼的.但是从发展和部门核心程度来讲,应 ...
- thinkphp5引入公共部分header、footer等
由于用惯了tp3.2,改用tp5有些还是感觉别扭的 直接上问题:项目中需要用到引入公共导航.头部.底部.右边部分等等 首先要弄清楚thinkphp5的配置项是哪个文件,众所周知:config.php, ...
- es6 语法 (let 和const)
一.let 和const 1.let 只在自己声明的块作用域中有效: function test(){ let a = 'a'; var b = 'b'; for(let i =1;i<3;i+ ...
- Vue2+VueRouter2+webpack 构建项目实战(二):目录以及文件结构
通过上一篇博文<Vue2+VueRouter2+webpack 构建项目实战(一):准备工作>,我们已经新建好了一个基于vue+webpack的项目.本篇文章详细介绍下项目的结构. 项目目 ...
- 洛谷P4704 太极剑(乱搞)
题意 题目链接 Sol 不会正解 写了发暴力过了,貌似跑的还挺快?.. // luogu-judger-enable-o2 // luogu-judger-enable-o2 #include< ...
- 一种快速构造和获取URL查询参数的方法:URLSearchParams
URLSearchParams 接口定义了一些实用的方法来处理 URL 的查询字符串. URLSearchParams()是个构造函数,将返回一个可以操作查询字符串的对象. 常用方法: 1.构造查询字 ...