Thuộc tính CSS
left =9 tham gia xác định vị trí nằm ngang của phần tử được định vị. Nó không có tác dụng đối với các phần tử không được định vị
auto |
=
|
Thử nó
cú pháp
/* values */
left: 3px;
left: 2.4em;
/* s of the width of the containing block */
left: 10%;
/* Keyword value */
left: auto;
/* Global values */
left: inherit;
left: initial;
left: revert;
left: revert-layer;
left: unset;
giá trị
left =0
auto |
=
|
Một
left =0 âm, null hoặc dương đại diện cho
auto |
=
|
- đối với các phần tử được định vị tuyệt đối, khoảng cách đến cạnh trái của khối chứa
- đối với các phần tử được định vị tương đối, khoảng cách mà phần tử được di chuyển sang bên phải của vị trí bình thường của nó
left =2
auto |
=
|
Một
left =2 chiều rộng của khối chứa
auto |
=
|
left =4
auto |
=
|
Chỉ định rằng
- đối với các phần tử được định vị tuyệt đối, vị trí của phần tử dựa trên thuộc tính
left =
0, trong khi
auto |
=
|
left =
1 được coi là chiều rộng dựa trên nội dung;
auto |
=
|
- đối với các phần tử được định vị tương đối, khoảng cách của phần tử từ vị trí bình thường của nó dựa trên thuộc tính
left =
0;
auto |
=
|
left =7
auto |
=
|
Chỉ định rằng giá trị giống với giá trị được tính toán từ phần tử cha của nó [có thể không phải là khối chứa nó]. Giá trị được tính toán này sau đó được xử lý như thể nó là một từ khóa
left =0,
auto |
=
|
left =2 hoặc
auto |
=
|
left =4
auto |
=
|
Sự mô tả
Hiệu ứng của
left =9 phụ thuộc vào cách phần tử được định vị [i. e. , giá trị của tài sản
auto |
=
|
position: absolute;
left: 20px;
top: 20px;
The only containing element for this div is the main window, so it
positions itself in relation to it.
position: relative;
top: 0;
right: 0;
Relative position in relation to its siblings.
float: right;
position: relative;
top: 20px;
left: 20px;
Relative to its sibling div above, but removed from flow of content.
position: absolute;
bottom: 10px;
right: 20px;
Absolute position inside of a parent with relative position
position: absolute;
right: 0;
left: 0;
top: 200px;
Absolute position with both left and right declared
2]- Khi
2 được đặt thànhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
4 hoặcposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
5, thuộc tínhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
left =
9 chỉ định khoảng cách giữa lề ngoài của cạnh trái của phần tử và đường viền trong của cạnh trái của khối chứa nó. [Khối chứa là tổ tiên mà phần tử được định vị tương đối. ]
auto |
=
|
- Khi
2 được đặt thànhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
8, thuộc tínhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
left =
9 chỉ định khoảng cách mà cạnh trái của phần tử được di chuyển sang phải so với vị trí bình thường của nó
auto |
=
|
- Khi
2 được đặt thànhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
left =
41, thuộc tính
auto |
=
|
left =
9 được sử dụng để tính toán hình chữ nhật ràng buộc dính
auto |
=
|
- Khi
2 được đặt thànhposition: absolute; left: 20px; top: 20px; The only containing element for this div is the main window, so it positions itself in relation to it. position: relative; top: 0; right: 0; Relative position in relation to its siblings. float: right; position: relative; top: 20px; left: 20px; Relative to its sibling div above, but removed from flow of content. position: absolute; bottom: 10px; right: 20px; Absolute position inside of a parent with relative position position: absolute; right: 0; left: 0; top: 200px; Absolute position with both left and right declared
left =
44, thuộc tính
auto |
=
|
left =
9 không có hiệu lực
auto |
=
|
Khi cả
left =9 và
auto |
=
|
left =0 được xác định và các ràng buộc về chiều rộng không ngăn cản điều đó, phần tử sẽ kéo dài để đáp ứng cả hai. Nếu phần tử không thể kéo dài để đáp ứng cả hai, vị trí của phần tử được chỉ định quá mức. Trong trường hợp này, giá trị
auto |
=
|
left =9 được ưu tiên khi vùng chứa từ trái sang phải;
auto |
=
|
định nghĩa chính thức
Giá trị ban đầu
left =4Áp dụng cho các phần tử được định vịInheritednoPercentages tham chiếu đến chiều rộng của khối chứa Giá trị tính toánnếu được chỉ định làm độ dài, độ dài tuyệt đối tương ứng;
auto |
=
|