CSS:水平与垂直居中

水平居中

margin: 0 auto;         /* 容器内div 水平居中,对于Firefox在需水平居中的容器处定义*/

text-align: center;         /* 容器内文字水平居中 */

单行内容垂直居中

给容器设置 line-height 和 height,并使两值相等,再加上 over-flow: hidden 就可以了。

overflow: hidden  自动隐藏超出的字符和图片,防止撑出层和表格的范围。

相关文章:

中文关键字:css div firefox 垂直 水平 容器 height hidden 单行 表格 字符 overflow 对于 范围 文字 自动 内容 margin center 图片 align auto line flow text over

你还可能感兴趣的相关文章

Incubus is
Email this author | All posts by Incubus

Leave a Reply