-webkit-text-stroke
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since April 2017.
Thuộc tính CSS -webkit-text-stroke chỉ định độ rộng và màu sắc của nét viền cho các ký tự văn bản. Đây là thuộc tính viết tắt cho các thuộc tính đầy đủ -webkit-text-stroke-width và -webkit-text-stroke-color.
Thuộc tính thành phần
Thuộc tính này là viết tắt của các thuộc tính CSS sau:
Cú pháp
css
/* Giá trị độ rộng và màu */
-webkit-text-stroke: 4px navy;
/* Giá trị toàn cục */
-webkit-text-stroke: inherit;
-webkit-text-stroke: initial;
-webkit-text-stroke: revert;
-webkit-text-stroke: revert-layer;
-webkit-text-stroke: unset;
Giá trị
Định nghĩa hình thức
| Initial value | as each of the properties of the shorthand:
|
|---|---|
| Applies to | all elements |
| Inherited | yes |
| Computed value | as each of the properties of the shorthand:
|
| Animation type | as each of the properties of the shorthand:
|
Cú pháp hình thức
-webkit-text-stroke =
<line-width> ||
<color>
<line-width> =
<length [0,∞]> |
hairline |
thin |
medium |
thick
Ví dụ
>Thêm nét viền văn bản màu đỏ
HTML
html
<p id="example">The stroke of this text is red.</p>
CSS
css
#example {
font-size: 3em;
margin: 0;
-webkit-text-stroke: 2px red;
}
Kết quả
Đặc tả
| Specification |
|---|
| Compatibility> # the-webkit-text-stroke> |