Thuộc tính CSS viền trái
Ví dụ
Đặt kiểu đường viền bên trái cho các phần tử khác nhau:
h1 {
border-left: 5px solid red;
}
h2 {
border-left: 4px dotted blue;
}
div {
border-left: double;
}
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính border-left
là thuộc tính viết tắt của (theo thứ tự sau):
- chiều rộng biên trái
- kiểu viền trái (bắt buộc)
- viền-trái-màu
Nếu bỏ qua màu viền trái thì màu được áp dụng sẽ là màu của văn bản.
Giá trị mặc định: | vừa không có màu |
---|---|
Thừa hưởng: | KHÔNG |
Hoạt hình: | vâng, xem các thuộc tính riêng lẻ . Đọc về hoạt hình Hãy thử nó |
Phiên bản: | CSS1 |
Cú pháp JavaScript: | object .style.borderLeft="3px chấm xanh" Hãy dùng thử |
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.
Property | |||||
---|---|---|---|---|---|
border-left | 1.0 | 4.0 | 1.0 | 3.5 | 1.0 |
Cú pháp CSS
border-left: border-width border-style border-color |initial|inherit;
Giá trị tài sản
Value | Description | Demo |
---|---|---|
border-left-width | Optional. Specifies the width of the left border. Default value is "medium" | Demo ❯ |
border-left-style | Required. Specifies the style of the left border. Default value is "none" | Demo ❯ |
border-left-color | Optional. Specifies the color of the left border. Default value is the color of the text | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Trang liên quan
Hướng dẫn CSS: Đường viền CSS
Tham chiếu DOM HTML: thuộc tính borderLeft