Phong cách justifyContent Thuộc tính
Thí dụ
Tạo khoảng cách giữa các mục của phần tử <div> linh hoạt:
document.getElementById("main").style.justifyContent = "space-between";
Định nghĩa và Cách sử dụng
Thuộc tính justifyContent sắp xếp các mục của vùng chứa linh hoạt khi các mục không sử dụng tất cả 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ả lại thuộc tính justifyContent:
object.style.justifyContent
Đặt thuộc tính justifyContent:
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ả lại: | Một chuỗi, đại diện cho thuộc tính justify-content 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 justify-content
HTML DOM STYLE Tham chiếu: thuộc tính alignContent
HTML DOM STYLE Tham khảo: thuộc tính alignItems
HTML DOM STYLE Tham khảo: thuộc tính alignSelf
❮ Đối tượng phong cách