CSS - max-height
概要
属性名 | max-height |
---|---|
値 | <length> | <percentage> | none | min-content | max-content | fit-content |
初期値 | none |
適用可能要素 | すべての要素 |
継承 | 継承しない |
メディア | visual |
サポート |
https://caniuse.com/mdn-css_properties_max-height https://caniuse.com/intrinsic-width |
説明
要素の最大の高さを指定します。
値 | 説明 |
---|---|
<length> | 高さを 10px 1.5em などの長さの単位で指定します。 |
<percentage> | 高さを 10% など、要素の大きさに対するパーセントで指定します。 |
none | 高さを制限しません。 |
min-content | コンテンツ中の最も長い単語の長さとなります。縦書きの場合に有効です。 |
max-content | コンテンツ中の文章が改行されない場合の長さとなります。縦書きの場合に有効です。 |
fit-content | コンテンツ中の文章が改行されない場合の長さとなります。ただし親要素の高さを超えることはありません。縦書きの場合に有効です。 |
使用例
HTML
<table style="height:150px;"> <tr style="vertical-align:top"> <td> <div style="max-height:120px; border:1px solid #999999; width:100px; overflow-y:scroll"> あああああああああ </div> </td> <td> <div style="max-height:120px; border:1px solid #999999; width:100px; overflow-y:scroll"> ああああああああああああああああああああああ </div> </td> <td> <div style="max-height:120px; border:1px solid #999999; width:100px; overflow-y:scroll"> あああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ </div> </td> </tr> </table>
表示
あああああああああ
|
ああああああああああああああああああああああ
|
あああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
|
関連項目
width, height, min-width, min-height, max-width, max-heightリンク
- http://www.w3.org/TR/CSS2/visudet.html#min-max-widths
- http://www.w3.org/TR/css3-box/#min-max
- http://www.d-toybox.com/spec/CSS3/box/index.html#the-min-width
- https://developer.mozilla.org/ja/docs/Web/CSS/max-width
- http://caniuse.com/#search=css%202.1%20properties
Copyright (C) 1997-2023 杜甫々
初版:1997年7月27日、最終更新:2023年5月7日
https://www.tohoho-web.com/css/prop/max-height.htm