共用方式為


min-height

設定元素的最小高度。

語法

{ min-height: sMinHeight }

可能的值

sMinHeight

指定或接收元素最小高度的變數:

length

浮點數,後面跟著絕對單位指示項 (cmmminptpc) 或相對單位指示項 (emexpx)。

如需有關支援長度單位的詳細資訊,請參閱 長度單位參照

percentage

整數後面接著百分比符號 (%),用來指定包含區塊高度的百分比,以作為元素最小高度使用。如果沒有明確設定包含區塊的高度,元素就不具備最小高度,而且 min-height 屬性會被解譯為 0%。如需有關包含區塊以及如何計算其高度的詳細資訊,請參閱 Cascading Style Sheets (CSS), Level 2, Revision 1 (CSS2.1) (階層式樣式表 (CSS) 層級 2 修訂 1 (CSS2.1)) 規格。

此屬性沒有預設值。這不是繼承屬性。

範例

下列範例顯示,針對 TR 元素使用 min-height 屬性的優點超過 height 屬性:

<html>
<head><title>CSS Min-Height Property Example</title>
</head>
<body>
<table border ="1" style="table-layout:fixed; width:100%;">
  <tr>
    <td style="height:35px;background-color:#99CCFF">This cell has the
<strong>height</strong> property set to 35px. In Internet Explorer, overflow text
is clipped when <strong>height</strong> is set on cells or rows in fixed-layout tables.
Setting the <strong>min-height</strong> property, however, accomodates overflow text 
by increasing the cell or row height.</td>
  </tr>
  <tr>
    <td style="min-height:35px;background-color:#99CCFF">This cell has the
<strong>min-height</strong> property set to 35px. In Internet Explorer, overflow text 
is clipped when <strong>height</strong> is set on cells or rows in fixed-layout tables.
Setting the <strong>min-height</strong> property, however, accomodates overflow text
by increasing the cell or row height.</td>
  </tr>
</table>
</body>
</html>

標準資訊

此屬性是在階層式樣式表 (CSS) 層級 2 (CSS2) (英文) 中定義。

適用於

A、ABBR、ACRONYM、ADDRESS、APPLET、B、BDO、BIG、BLOCKQUOTE、BUTTON、CAPTION、CENTER、CITE、CODE、CUSTOM、DD、DEL、DFN、DIV、DL、DT、EM、EMBED、FIELDSET、FONT、FORM、FRAME、FRAMESET、HN、HR、I、IFRAME、IMG、INPUT TYPE=BUTTON、INPUT TYPE=CHECKBOX、INPUT TYPE=FILE、INPUT TYPE=IMAGE、INPUT TYPE=PASSWORD、INPUT TYPE=RADIO、INPUT TYPE=RESET、INPUT TYPE=SUBMIT、INPUT TYPE=TEXT、INS、LI、OBJECT、OL、OPTION、P、Q、RT、RUBY、S、SELECT、SPAN、SUB、TABLE、TD、TH、TR、TT、U、UL、VAR、XMP

請參閱

概念

height

max-height

width

min-width

max-width