Thuộc tính kiểu biện minh cho nội dung
Ví dụ
Tạo khoảng trống giữa các mục của phần tử <div> linh hoạt:
document.getElementById("main").style.justifyContent = "space-between";
Hãy tự mình thử »Sự miêu tả
Thuộc tínhjustContent căn chỉnh các mục của vùng chứa linh hoạt khi các mục đó không sử dụng hết không gian có sẵn trên trục chính (theo chiều ngang).
Mẹo: Sử dụng thuộc tính AlignContent để căn chỉnh các mục trên trục chéo (theo chiều dọc).
Hỗ trợ trình duyệt
Property | |||||
---|---|---|---|---|---|
justifyContent | Yes | 12.0 | Yes | 9.0 | Yes |
Cú pháp
Trả về thuộc tínhjustContent:
object .style.justifyContent
Đặt thuộc tínhjustContent:
object .style.justifyContent = "flex-start|flex-end|center|space-between|space-around|initial|inherit"
Giá trị tài sản
Value | Description |
---|---|
flex-start | Default value. Items are positioned at the beginning of the container |
flex-end | Items are positioned at the end of the container |
center | Items are positioned at the center of the container |
space-between | Items are positioned with space between the lines |
space-around | Items are positioned with space before, between, and after the lines |
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: | khởi động linh hoạt |
---|---|
Giá trị trả về: | Một Chuỗi, biểu thị thuộc tính just-content của một phần tử |
Phiên bản CSS | CSS3 |
Trang liên quan
Tham chiếu CSS: thuộc tính biện minh cho nội dung
HTML DOM STYLE Tham chiếu: thuộc tính AlignContent
HTML DOM STYLE Tham chiếu: thuộc tính AlignItems
HTML DOM STYLE Tham chiếu: thuộc tính AlignSelf