Gaya MaxHeight Property
Contoh
Setel tinggi maksimum elemen <div>:
document.getElementById("myDIV").style.maxHeight = "15px";
Definisi dan Penggunaan
Properti maxHeight menetapkan atau mengembalikan tinggi maksimum suatu elemen.
Properti maxHeight hanya berpengaruh pada elemen level blok atau elemen dengan posisi absolut atau tetap.
Catatan: Tinggi elemen tidak boleh lebih besar dari nilai yang ditentukan oleh properti maxHeight.
Tip: Untuk menyetel atau mengembalikan tinggi minimum suatu elemen, gunakan properti minHeight .
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
maxHeight | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti maxHeight:
object.style.maxHeight
Setel properti maxHeight:
object.style.maxHeight = "none|length|%|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | tidak ada |
---|---|
Nilai Kembali: | Sebuah String, mewakili ketinggian maksimum suatu elemen |
Versi CSS | CSS2 |
Lebih Banyak Contoh
Contoh
Kembalikan tinggi maksimum elemen <div>:
alert(document.getElementById("myDIV").style.maxHeight);
Halaman Terkait
Tutorial CSS: Dimensi CSS
Referensi CSS: properti max-height
Objek Gaya