Gaya justifyContent Property
Contoh
Beri jarak di antara item elemen <div> fleksibel:
document.getElementById("main").style.justifyContent = "space-between";
Definisi dan Penggunaan
Properti justifyContent menyelaraskan item wadah fleksibel saat item tidak menggunakan semua ruang yang tersedia pada sumbu utama (secara horizontal).
Tip: Gunakan properti alignContent untuk meratakan item pada sumbu silang (vertikal).
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Sintaksis
Kembalikan properti justifyContent:
object.style.justifyContent
Setel properti justifyContent:
object.style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Nilai properti
Value | Description |
---|---|
flex-start | Default value. Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
center | Items are positioned at the center 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: | mulai fleksibel |
---|---|
Nilai Kembali: | Sebuah String, mewakili properti justify-content dari suatu elemen |
Versi CSS | CSS3 |
Halaman Terkait
Referensi CSS: properti justify-content
Referensi GAYA DOM HTML: properti alignContent
Referensi GAYA DOM HTML: properti alignItems
Referensi GAYA DOM HTML: properti alignSelf
Objek Gaya