<polyline>
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
Phần tử <polyline> của SVG là một hình cơ bản SVG tạo ra các đường thẳng nối nhiều điểm. Thông thường polyline được dùng để tạo các hình mở vì điểm cuối không bắt buộc phải nối với điểm đầu. Với các hình khép kín, xem phần tử <polygon>.
Ngữ cảnh sử dụng
| Categories | Basic shape element, Graphics element, Shape element |
|---|---|
| Permitted content | Any number of the following elements, in any order: Animation elements Descriptive elements |
Thuộc tính
points-
Thuộc tính này định nghĩa danh sách các điểm (các cặp tọa độ tuyệt đối x,y) cần để vẽ polyline Kiểu giá trị: <number>+; Giá trị mặc định:
""; Có thể hoạt ảnh: có pathLength-
Thuộc tính này cho phép chỉ định tổng chiều dài của path, tính theo đơn vị người dùng. Kiểu giá trị: <number>; Giá trị mặc định: không có; Có thể hoạt ảnh: có
Giao diện DOM
Phần tử này triển khai giao diện SVGPolylineElement.
Ví dụ
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<!-- Ví dụ về một polyline với fill mặc định -->
<polyline points="0,100 50,25 50,75 100,0" />
<!-- Ví dụ về cùng hình polyline nhưng có stroke và không fill -->
<polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" />
</svg>
Đặc tả
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2> # PolylineElement> |