CSSUnitValue: unit property
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Thuộc tính chỉ đọc CSSUnitValue.unit
của giao diện CSSUnitValue trả về chuỗi
cho biết loại đơn vị.
Giá trị
Một chuỗi.
Ví dụ
Ví dụ sau tạo CSSPositionValue từ các
hàm khởi tạo CSSUnitValue, sau đó truy vấn
CSSUnitValue.unit.
js
const pos = new CSSPositionValue(
new CSSUnitValue(5, "px"),
new CSSUnitValue(10, "em"),
);
console.log(pos.x.unit); // "px"
console.log(pos.y.unit); // "em"
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| CSS Typed OM Level 1> # dom-cssunitvalue-unit> |