CSS 垂直居中。
2016-01-01 12:01
615 查看
1,display: table; display: table-cell
<div style="border:solid red 1px ;height:200px;width:200px;display: table;">
<div style="display: table-cell; vertical-align:middle; width:100%; text-align:center;"> Testaaaaaaaaaaaaaaaaaaa<br/>
Testaaaaaaaaaaaaaaaaaaa<br/>
</div>
</div>
display:flex;
flex-direction: row | row-reverse | column | column-reverse;
flex-wrap: nowrap | wrap | wrap-reverse;
flex-flow: <‘flex-direction’> || <‘flex-wrap’>
justify-content: flex-start | flex-end | center | space-between | space-around;
align-items: flex-start | flex-end | center | baseline | stretch;
align-content: flex-start | flex-end | center | space-between | space-around | stretch;
order: <integer>;
flex-grow: <number>;
flex-shrink: <number>; /* default 1 */
flex-basis: <length> | auto;
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
align-self: auto | flex-start | flex-end | center | baseline | stretch;
<div style="border:solid red 1px ;height:200px;width:200px;display: table;">
<div style="display: table-cell; vertical-align:middle; width:100%; text-align:center;"> Testaaaaaaaaaaaaaaaaaaa<br/>
Testaaaaaaaaaaaaaaaaaaa<br/>
</div>
</div>
display:flex;
flex-direction: row | row-reverse | column | column-reverse;
flex-wrap: nowrap | wrap | wrap-reverse;
flex-flow: <‘flex-direction’> || <‘flex-wrap’>
justify-content: flex-start | flex-end | center | space-between | space-around;
align-items: flex-start | flex-end | center | baseline | stretch;
align-content: flex-start | flex-end | center | space-between | space-around | stretch;
order: <integer>;
flex-grow: <number>;
flex-shrink: <number>; /* default 1 */
flex-basis: <length> | auto;
flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
align-self: auto | flex-start | flex-end | center | baseline | stretch;
相关文章推荐
- CSS 巧用 :before和:after
- Nancy Scripts,CSS文件夹配置
- TextView显示html样式的文字
- css中pt、px、em、ex、in等这类长度单位详细说明
- 专为控制打印设计的CSS样式
- input的值为浅淡样式(点击值消失)
- data-role="navbar" 导航框样式被挤下去
- PyCharm中HTML页面CSS class名称自动完成功能失效的问题
- 16.定位模板,布局和样式
- CSS属性简写
- WPF自定义Button样式(按钮长度随Content长度自适应)
- css bottom top left right
- CSS3:text-overflow实现文字截取,超出部分显示省略号
- CSS透明属性详解
- EditText 隐藏密码 字体样式被改变
- Hack、自适应、针对浏览器写样式随手笔记
- CSS块级元素和行内元素
- 鼠标hover 加样式,并且当前active样式消失
- CSS中的几种布局模型
- css属性之transition