Styl maxHeight Property
Przykład
Ustaw maksymalną wysokość elementu <div>:
document.getElementById("myDIV").style.maxHeight = "15px";
Definicja i użycie
Właściwość maxHeight ustawia lub zwraca maksymalną wysokość elementu.
Właściwość maxHeight ma wpływ tylko na elementy blokowe lub elementy z bezwzględną lub stałą pozycją.
Uwaga: Wysokość elementu nigdy nie może być większa niż wartość określona przez właściwość maxHeight.
Porada: Aby ustawić lub zwrócić minimalną wysokość elementu, użyj właściwości minHeight .
Obsługa przeglądarki
Property | |||||
---|---|---|---|---|---|
maxHeight | Yes | Yes | Yes | Yes | Yes |
Składnia
Zwróć właściwość maxHeight:
object.style.maxHeight
Ustaw właściwość maxHeight:
object.style.maxHeight = "none|length|%|initial|inherit"
Wartości nieruchomości
Value | Description |
---|---|
none | No limit on the height of the element. This is default |
length | Defines the maximum height in length units |
% | Defines the maximum height in % of the parent element |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Szczegóły techniczne
Domyślna wartość: | Żaden |
---|---|
Wartość zwrotu: | String, reprezentujący maksymalną wysokość elementu |
Wersja CSS | CSS2 |
Więcej przykładów
Przykład
Zwróć maksymalną wysokość elementu <div>:
alert(document.getElementById("myDIV").style.maxHeight);
Powiązane strony
Samouczek CSS: wymiar CSS
Odniesienie CSS: właściwość max-height
❮ Obiekt stylu