Properti penyelarasan konten CSS
Contoh
Kemas garis ke arah tengah wadah fleksibel:
div
{
width: 70px;
height: 300px;
border: 1px solid #c3c3c3;
display: flex;
flex-wrap: wrap;
align-content: center;
}
Definisi dan Penggunaan
Properti align-content
memodifikasi perilaku properti
flex-wrap . Ini mirip dengan
align-items , tetapi alih-alih menyelaraskan item fleksibel, itu menyelaraskan garis fleksibel.
Catatan: Harus ada beberapa baris item agar properti ini memiliki efek!
Tips: Gunakan properti justify-content untuk meratakan item pada sumbu utama (secara horizontal).
Nilai bawaan: | meregang |
---|---|
Diwarisi: | tidak |
Animasi: | tidak. Baca tentang animasi |
Versi: kapan: | CSS3 |
Sintaks JavaScript: | objek .style.alignContent="center" |
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung properti.
Angka diikuti oleh -webkit- menentukan versi pertama yang berfungsi dengan awalan.
Property | |||||
---|---|---|---|---|---|
align-content | 21.0 | 11.0 | 28.0 | 9.0 7.0 -webkit- |
12.1 |
Sintaks CSS
align-content: stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit;
Nilai properti
Value | Description | Play it |
---|---|---|
stretch | Default value. Lines stretch to take up the remaining space | |
center | Lines are packed toward the center of the flex container | |
flex-start | Lines are packed toward the start of the flex container | |
flex-end | Lines are packed toward the end of the flex container | |
space-between | Lines are evenly distributed in the flex container | |
space-around | Lines are evenly distributed in the flex container, with half-size spaces on either end | |
space-evenly | Lines are evenly distributed in the flex container, with equal space around them | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Halaman Terkait
Referensi CSS: properti align-items
Referensi CSS: align-self property
Referensi CSS: properti justify-content
Referensi DOM HTML: properti alignContent