Properti CSS overflow
Contoh
Tampilkan nilai properti overflow yang berbeda:
div.ex1 {
overflow: scroll;
}
div.ex2 {
overflow: hidden;
}
div.ex3 {
overflow:
auto;
}
div.ex4 {
overflow: visible;
}
Definisi dan Penggunaan
Properti overflow
menentukan apa yang harus terjadi jika konten melebihi kotak elemen.
Properti ini menentukan apakah akan memotong konten atau menambahkan bilah gulir saat konten elemen terlalu besar untuk muat di area tertentu.
Catatan: Properti overflow
hanya berfungsi untuk elemen blok dengan ketinggian tertentu.
Nilai bawaan: | terlihat |
---|---|
Diwarisi: | tidak |
Animasi: | tidak. Baca tentang animasi |
Versi: kapan: | CSS2 |
Sintaks JavaScript: | objek .style.overflow="gulir" |
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Property | |||||
---|---|---|---|---|---|
overflow | 1.0 | 4.0 | 1.0 | 1.0 | 7.0 |
Catatan: Di OS X Lion (di Mac), bilah gulir disembunyikan secara default dan hanya ditampilkan saat digunakan (meskipun "overflow:scroll" disetel).
Sintaks CSS
overflow: visible|hidden|scroll|auto|initial|inherit;
Nilai properti
Value | Description | Play it |
---|---|---|
visible | The overflow is not clipped. It renders outside the element's box. This is default | |
hidden | The overflow is clipped, and the rest of the content will be invisible | |
scroll | The overflow is clipped, but a scroll-bar is added to see the rest of the content | |
auto | If overflow is clipped, a scroll-bar should be added to see the rest of the content | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Halaman Terkait
Tutorial CSS: CSS Overflow
Tutorial CSS: Pemosisian CSS
Referensi HTML DOM: properti overflow