Strict Standards: Non-static method Protector::getInstance() should not be called statically in /home/suehirogari/suehirogari.com/xoops_trust_path/modules/protector/include/precheck_functions.php on line 12

Strict Standards: Non-static method XCube_Root::getSingleton() should not be called statically in /home/suehirogari/suehirogari.com/public_html/include/common.php on line 18

Deprecated: Non-static method XCube_Root::getSingleton() should not be called statically, assuming $this from incompatible context in /home/suehirogari/suehirogari.com/public_html/modules/user/preload/Primary/Primary.class.php on line 13
cssで縦のセンタリング 中央揃え | 社内SEのウェブ制作

2011.02.21xoopsズープス

cssで縦のセンタリング 中央揃え

CSS で横のセンタリング(中央揃え)は margin : auto や text-align : center などで事足りると思うのですが、縦のセンタリング(中央揃え)は何を使えば良いかご存知ですか?

私はつい先日まで知らなかったのですが line-height プロパティで縦のセンタリングが可能です。方法はとても簡単で、ボックスの高さと line-height の値を同じにするだけで縦のセンタリングが行われます。下のソースを参考にしてください。

div.hajime {
	width : 400px;
	height : 50px;/*ボックスの高さ*/
line-height : 50px;/*縦のセンタリングの為に指定*/
}

このカテゴリの人気記事



  • コメント (0)
  • トラックバック (0)
  • 閲覧 (18913)

トラックバック

トラックバックpingアドレス http://www.suehirogari.com/modules/blog/tb.php/161

コメントの投稿

コメント投稿に関するルール : コメントは全て承認が必要

キーワードでサイト内を検索
人気のエントリ