CSSのmax-heightプロパティ
例
<p>要素の最大高さを50ピクセルに設定します。
p.ex1
{
max-height: 50px;
}
定義と使用法
プロパティは、要素のmax-height
最大の高さを定義します。
コンテンツが最大の高さよりも大きい場合、オーバーフローします。コンテナがオーバーフローコンテンツを処理する方法は、 overflowプロパティによって定義されます。
コンテンツが最大の高さよりも小さい場合、
max-height
プロパティは効果がありません。
注:これにより、
heightプロパティの値が。より大きくなる
のを防ぎますmax-height
。プロパティの値は
max-height
、heightプロパティをオーバーライドします。
デフォルト値: | なし |
---|---|
遺伝性の: | いいえ |
アニメート可能: | はい、個々のプロパティを参照してください。アニメート可能について読む |
バージョン: | CSS2 |
JavaScript構文: | object .style.maxHeight = "100px" |
ブラウザのサポート
表の数字は、プロパティを完全にサポートする最初のブラウザバージョンを示しています。
Property | |||||
---|---|---|---|---|---|
max-height | 1.0 | 7.0 | 1.0 | 2.0.2 | 7.0 |
CSS構文
max-height: none|length|initial|inherit;
プロパティ値
Value | Description | Play it |
---|---|---|
none | No maximum height. This is default | |
length | Defines the maximum height in px, cm, etc. Read about length units | |
% | Defines the maximum height in percent of the containing block | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
関連ページ
CSSチュートリアル:CSSの高さと幅
CSSリファレンス:min-heightプロパティ
HTML DOMリファレンス: maxHeightプロパティ