CSS align-items Property
Contoh
Pusatkan perataan untuk semua item elemen <div> fleksibel:
div
{
display: flex;
align-items: center;
}
Definisi dan Penggunaan
Properti align-items
menentukan perataan default untuk item di dalam wadah fleksibel.
Tip: Gunakan properti align-self dari setiap item untuk menimpa align-items
properti.
Nilai bawaan: | meregang |
---|---|
Diwarisi: | tidak |
Animasi: | tidak. Baca tentang animasi |
Versi: kapan: | CSS3 |
Sintaks JavaScript: | objek .style.alignItems="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-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
Sintaks CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Nilai properti
Value | Description | Play it |
---|---|---|
stretch | Default. 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 | |
baseline | Items are positioned at the baseline of the container | |
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-content
Referensi CSS: align-self property
Referensi DOM HTML: properti alignItems