Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created August 1, 2018 05:47
Show Gist options
  • Save ThaddeusJiang/e5df781756461df435c0c2b6a16ebc3c to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/e5df781756461df435c0c2b6a16ebc3c to your computer and use it in GitHub Desktop.
[CSS] 单行文字 垂直居中

如果一个容器中只有一行文字的话, 让它垂直居中比较简单 直接定义height(高度)和 line-height(行高)相等即可。

<div style="height:25px;line-height:25px;overflow:hidden">aa</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment