博客
关于我
垂直居中 - 使用 line-height
阅读量:712 次
发布时间:2019-03-21

本文共 309 字,大约阅读时间需要 1 分钟。

垂直居中单行文本的实现方法,可以通过设置line-height高度和height高度一致来实现。如果文本只有一行,可以直接应用相同的高度属性。

以下是一组具体示例:

.center {    line-height: 200px;    height: 200px;    border: 3px solid green;    text-align: center;}

当内容包含多行文本时,需要特别调整字体高度。例如,您可以增加CSS如下:

.center p {    line-height: 1.5;    display: inline-block;    vertical-align: middle;}

转载地址:http://himez.baihongyu.com/

你可能感兴趣的文章
PyTorch之torch.utils.data.DataLoader解读
查看>>
PyTorch之DataLoader杂谈
查看>>
presto、druid、sparkSQL、kylin的对比分析
查看>>
Presto分布式大数据查询引擎
查看>>
Presto架构及原理
查看>>
Presto(一)集群部署
查看>>
Presto(二)开启安全认证
查看>>
Pricing procedure Steps and Details in SAP MM (from SCN)
查看>>
Prim 算法在不同权重范围内的性能分析及其实现
查看>>
Primace 5.0软件与KEIL单片机软件联合在线仿真步骤
查看>>
Prime Distance
查看>>
Prim求MST最小生成树
查看>>
Prim算法与Kruskal算法在均匀分布权重图中的性能比较
查看>>