CSSでmin-heightをブラウザに関係なく使いたい。
そんなあなたにおすすめなのが、『Easiest cross-browser CSS min-height』。CSSでmin-heightをクロスブラウザにする最も簡単な方法だ。
There are still enough folks using IE6, unfortunately, and it doesn't support the min-height or min-width CSS parameters. This has caused the invention of a number of different hacks and browser-conditional style sheets to get the desired effect.
Many of the different methods work well, but after trying a number of them, I can say that the following method is the easiest to use and is compatable across all common versions of Firefox, Safari, and IE.
要約すると、
IE6では min-height や min-width が効かないため、それを効かせるためにはいろいろなハックやブラウザごとのスタイルシートが必要だった。
しかし以下のようにすればIE6にも対応したものが実現できる。
■min-height
.foo {
min-height:100px;
height: auto !important;
height: 100px;
}
■min-width
.bar {
min-width:100px;
width: auto !important;
width: 100px;
}
とのことで、かなり使えそうなCSSではないだろうか。
CSSでmin-heightをクロスブラウザにする最も簡単な方法、チェックして使っていきたいですね。
今日のCREAMU
コンクリートに打ち込むフックや3Mの強力両面テープを買ってきた。かなり使えますね。いい感じだ。
あと友人がMacBook Airを買ってAir談義で盛り上がっています。






コメント一覧
いやー
今までで見てきた方法の中では一番スマートだなー
すげえ
投稿者: 通りすがり | 2008年3月29日 08:59
コメントを残しておきます。
大分前から知られている手法ですが、!importantを指定することに違和感を覚えます。
http://hxxk.jp/2005/12/27/2246
この手法の利用者は当該IEに対する例外的なスタイルで指定した方がスマートな場合があることを十分承知すべきです。
投稿者: coeurl | 2008年3月28日 01:00
こんにちわ。
こんなに簡単な方法で適用されるなんて夢の様です。
早速試してみましたが、ちゃんと適用されているみたいでした。
投稿者: kazu | 2008年3月25日 18:24