StupidBeauty
Read times:434Posted at:Thu Oct 27 19:39:10 2011
- no title specified

转载:CSS竖直对齐vertical-align属性详解

http://www.noahlu.com/blog/website-design/css-vertical-align/

亮点:

方法二:

这个方法同样有两个前提条件:

  1. 1.你只有一行文字需要竖直居中

  2. 2.你能给父元素设定固定高度

符合这个条件可以使用此解决办法,很简单:设置父元素line-height与其固定高度相同即可。
示例代码:

<style>

#myoutercontainer2 { line-height:4em }

</style>

...

<p>

Hey, this is vertically centered. Yay!

</p>

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands