Gaya alignContent Property
Contoh
Posisikan item elemen <div> fleksibel dengan spasi di antara baris:
document.getElementById("main").style.alignContent = "space-between";
Definisi dan Penggunaan
Properti alignContent menyelaraskan item wadah fleksibel saat item tidak menggunakan semua ruang yang tersedia pada sumbu silang (vertikal).
Tip: Gunakan properti justifyContent untuk meratakan item pada sumbu utama (secara horizontal).
Catatan: Harus ada beberapa baris item agar properti ini memiliki efek apa pun.
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Angka yang diikuti oleh Webkit menentukan versi pertama yang berfungsi dengan awalan.
Property | |||||
---|---|---|---|---|---|
alignContent | 21.0 | 11.0 | 28.0 | 9.0 7.0 Webkit |
12.1 |
Sintaksis
Kembalikan properti alignContent:
object.style.alignContent
Setel properti alignContent:
object.style.alignContent = "stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit"
Nilai properti
Value | Description |
---|---|
stretch | Default value. Items are stretched to fit the container |
center | Items are positioned at the center of the container |
flex-start | Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
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: | meregang |
---|---|
Nilai Kembali: | Sebuah String, mewakili properti align-content dari suatu elemen |
Versi CSS | CSS3 |
Halaman Terkait
Referensi CSS: properti align-content
Referensi GAYA DOM HTML: properti alignItems
Referensi GAYA DOM HTML: properti alignSelf
Referensi GAYA DOM HTML: properti justifyContent