Căn chỉnh kiểuTự thuộc tính
Ví dụ
Đặt cách sắp xếp cho một trong các mục bên trong phần tử linh hoạt để vừa với vùng chứa:
document.getElementById("myBlueDiv").style.alignSelf = "stretch";
Hãy tự mình thử »Sự miêu tả
Thuộc tính AlignSelf chỉ định cách căn chỉnh cho mục đã chọn bên trong vùng chứa linh hoạt.
Lưu ý: Thuộc tính AlignSelf ghi đè thuộc tính AlignItems của vùng chứa linh hoạt.
Cú pháp
Trả về thuộc tính AlignSelf:
object .style.alignSelf
Đặt thuộc tính AlignSelf:
object .style.alignSelf = "auto|stretch|center|flex-start|flex-end|baseline|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
auto | Default. The element inherits its parent container's align-items property, or "stretch" if it has no parent container |
stretch | The element is positioned to fit the conatiner |
center | The element is positioned at the center of the container |
flex-start | The element is are positioned at the beginning of the container |
flex-end | The element is positioned at the end of the container |
baseline | The element is 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: | tự động |
---|---|
Giá trị trả về: | Một Chuỗi, biểu thị thuộc tính Align-self của một phần tử |
Phiên bản CSS | CSS3 |
Hỗ trợ trình duyệt
alignSelf
là một tính năng của CSS3 (1999).
Nó được hỗ trợ đầy đủ trong tất cả các trình duyệt:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | 11 |
Trang liên quan
Tham chiếu CSS: thuộc tính tự căn chỉnh
HTML DOM STYLE Tham chiếu: thuộc tính AlignContent
HTML DOM STYLE Tham chiếu: thuộc tính AlignItems