CSS align-items Thuộc tính
Thí dụ
Căn giữa các căn cho tất cả các mục của phần tử <div> linh hoạt:
div
{
display: flex;
align-items: center;
}
Định nghĩa và Cách sử dụng
Thuộc align-items
tính chỉ định căn chỉnh mặc định cho các mục bên trong vùng chứa linh hoạt.
Mẹo: Sử dụng thuộc tính tự căn chỉnh của từng mục để ghi đè thuộc align-items
tính.
Giá trị mặc định: | căng ra |
---|---|
Thừa hưởng: | không |
Hoạt hình: | không. Đọc về hoạt hình |
Phiên bản: | CSS3 |
Cú pháp JavaScript: | đối tượng .style.alignItems = "center" |
Hỗ trợ trình duyệt
Các số trong bảng chỉ định phiên bản trình duyệt đầu tiên hỗ trợ đầy đủ thuộc tính.
Các số theo sau -webkit- chỉ định phiên bản đầu tiên hoạt động với tiền tố.
Property | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
Cú pháp CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Giá trị tài sản
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 |
Các trang liên quan
Tham chiếu CSS: thuộc tính align-content
Tham khảo CSS: thuộc tính align-self
Tham chiếu DOM HTML: thuộc tính alignItems