Thuộc tính style alignItems
Thí dụ
Định vị các căn chỉnh cho tất cả các mục của phần tử <div> linh hoạt ở đầu vùng chứa:
document.getElementById("main").style.alignItems = "flex-start";
Định nghĩa và Cách sử dụng
Thuộc tính alignItems 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 align-self của từng mục để ghi đè thuộc tính align-items.
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 bởi Webkit chỉ định phiên bản đầu tiên hoạt động với tiền tố.
Property | |||||
---|---|---|---|---|---|
alignItems | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
Cú pháp
Trả về thuộc tính alignItems:
object.style.alignItems
Đặt thuộc tính alignItems:
object.style.alignItems = "stretch|center|flex-start|flex-end|baseline|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
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 |
Chi tiết kỹ thuật
Giá trị mặc định: | căng ra |
---|---|
Giá trị trả lại: | Một chuỗi, đại diện cho thuộc tính align-items của một phần tử |
Phiên bản CSS | CSS3 |
Các trang liên quan
Tham chiếu CSS: thuộc tính align-items
HTML DOM STYLE Tham chiếu: thuộc tính alignContent
HTML DOM STYLE Tham khảo: thuộc tính alignSelf