Panel结构
参考weui的Panel结构
核心:定位,补充:对容器设置font-size:0,消除img下多出的3px,防止居中出现偏差。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}
.flex-col{-webkit-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
.flex-row{-webkit-box-orient:vertical;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}
.flex-1{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;}
.flex-align-center{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;}
.flex-pack-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}
.flex-pack-justify{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}
body,html,ul,li,p{
margin:0;padding:0;
}
img{
display:block;
}
.box_appmsg{
padding:15px;
border:1px solid red;
}
.box_appmsg .box_hd{
font-size:0;
width: 60px;
height: 60px;
line-height: 60px;
text-align: center;
position: relative;
border:1px solid black;
}
.box_appmsg .box_thumb{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
max-width: 100%;
max-height: 100%;
}
.list-info{
margin-left:.8em;
}
</style>
</head>
<body>
<ul>
<li class="flex flex-row flex-align-center box_appmsg">
<div class="box_hd">
<img class="box_thumb" src="http://c.hiphotos.baidu.com/image/pic/item/5366d0160924ab1835f8e0fd3cfae6cd7a890b09.jpg" alt="">
</div>
<div class="flex-1 list-info">
<p>商品</p>
<p>价格</p>
</div>
</li>
</ul>
</body>
</html>

预览:
https://besswang.github.io/Panel/index.html
拓展:
还有一种居中的方案,不过是针对文字的居中。是文字内容,不是所有的标签;
核心思想:父级:text-align:center; 子级:vertical-align:middle;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.flex{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}
.flex-col{-webkit-box-orient:vertical;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
.flex-row{-webkit-box-orient:vertical;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;}
.flex-1{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;}
.flex-align-center{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;}
.flex-pack-center{-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}
.flex-pack-justify{-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;}
body,html,ul,li,p{
margin:0;padding:0;
}
img{
display:block;
}
.box_appmsg{
padding:15px;
border:1px solid red;
}
.box_appmsg .box_hd{
width: 60px;
height: 60px;
line-height: 60px;
text-align: center;
border:1px solid black;
}
.box_appmsg .box_thumb{
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
.list-info{
margin-left:.8em;
}
</style>
</head>
<body>
<ul>
<li class="flex flex-row flex-align-center box_appmsg">
<div class="box_hd">
2233
<!-- <img class="box_thumb" src="http://c.hiphotos.baidu.com/image/pic/item/5366d0160924ab1835f8e0fd3cfae6cd7a890b09.jpg" alt=""> -->
</div>
<div class="flex-1 list-info">
<p>商品</p>
<p>价格</p>
</div>
</li>
</ul>
</body>
</html>

Panel结构的更多相关文章
- Lesson5——Pandas Panel三维数据结构
pandas目录 1 简介 自 Pandas 0.25 版本后, Panel 结构已经被废弃. pd.__version__ #查看pandas版本 #'1.2.4' #或者 pd.show_vers ...
- Bootstrap3 入门实战
因为公司选择了使用BootStrap3作为项目的前台展示框架,所以花了半天时间来学习Bootstrap, 如果你是第一次听说,或者说以前听说过,但没有使用过这个框架的话,希望这篇入门实战能够让你快速掌 ...
- C++: 基于四叉树数据结构的自适应网格(初探)
C++: 基于四叉树数据结构的自适应网格 二叉树是一种典型的非线性存储数据结构,查找效率可以达到\(O(log_2N)\),同样,这类树状结构存在许多种变体,详细参考邓俊辉老师的<数据结构C++ ...
- 轻量级富文本编辑器wangEditor源码结构介绍
1. 引言 wangEditor——一款轻量级html富文本编辑器(开源软件) 网站:http://www.wangeditor.com/ demo演示:http://www.wangeditor.c ...
- NGUI创建Camera参数为Simple 2D的UI UI对象的结构UI Root(2D)
NGUI创建Camera参数为Simple 2D的UI UI对象的结构UI Root(2D) 使用NGUI创建的Camera参数为Simple 2D的UI,会在游戏的场景中生成1个名为UI Root( ...
- ExtJS MVC结构
概述 大型的应用在开发和运维上都存在着困难.应用功能的调整和开发人员的调动都会影响对项目的掌控.ExtJS4带来了一种新的应用结构.这种结构不止用于组织代码,也能有效的减少必要的代码量. 这次ExtJ ...
- 深入浅出ExtJS 第五章 树形结构
5.1 TreePanel的基本使用 //树是一种非常典型的数据结构; 5.1.1 创建一棵树 //树控件有Ext.tree.TreePanel类定义,控件的名称为TreePanel;TreePane ...
- 无废话网页重构系列——(6)HTML主干结构:站点(site)、页面(page)
本文作者:大象本文地址:http://www.cnblogs.com/daxiang/p/4653546.html 在分析和切出设计稿,以及部署项目目录文件后,开始写HTML Demo. 首先,弄出H ...
- Ext.tree.Panel Extjs 在表格中添加树结构,并实现节点移动功能
最近在用Extjs 做后台管理系统,真的非常好用.总结的东西分享一下. 先展示一下效果图 好了,开始吧! 首先说一下我的创建结构: 一.构造内容 这个函数中包括store的创建,treePanel的创 ...
随机推荐
- VS2015 applicationhost.config 本地域名访问
.vs\config\applicationhost.config <?xml version="1.0" encoding="UTF-8"?> & ...
- iOS:scale image
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0); [image drawInRect:CGRectMake(, , newSize.w ...
- angular.extend深拷贝(deep copy)
在用到angular.extend的时候,正好碰到一个对象,是层层嵌套的Array, 结果发现只能extend第一层,查阅官文档,确实不支持deep copy: Note: Keep in mind ...
- 安全检测:2013 Top 10 List
转自:https://www.owasp.org/index.php/Top_10_2013-Top_10 Risk 2013 Table of Contents 2013 Top 10 List ...
- Android开发学习笔记-实现联网检测程序版本
package com.frank.mobilesafe; import java.io.InputStream; import java.net.HttpURLConnection; import ...
- .NET工具集合
工具 (1) 代码分析 .NET Memory Profiler - http://memprofiler.com/ANTS Profiler - http://www.red-gate.com/co ...
- PHP 使用redis
<?php /*从平台获取数据库名*/ $dbname = ""; /*从环境变量里取host,port,user,pwd*/ $host = ''; $port = ''; ...
- Okhttp封装、网络层扩展
一.概述 首先在这里本片文章是以网络通信封装为主,而app开发首先重要就是网络通信,而如今主流的async.volley.okhttp等,阿么这么网络库怎样能做到更好封装.更好的切换,从而不影响业务层 ...
- SqlServer当前月份时间
SqlServer当前月份时间 SELECT -DAY(getdate()+-DAY(getdate()))
- JSONP 劫持漏洞实例
0x01 Jsonp简介 Jsonp(JSON with Padding) 是 json 的一种"使用模式",可以让网页从别的域名(网站)那获取资料,即跨域读取数据. 为什么我们从 ...