SVGPreserveAspectRatio:meetOrSlice 屬性
meetOrSlice 是 SVGPreserveAspectRatio 介面的一個只讀屬性,它反映了該介面中 SVG_MEETORSLICE_* 常量所指定的 meet-or-slice 值的型別。
值
以下之一:
SVGPreserveAspectRatio.SVG_MEETORSLICE_UNKNOWN(0)SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET(1)SVGPreserveAspectRatio.SVG_MEETORSLICE_SLICE(2)
示例
訪問 meetOrSlice 屬性
html
<svg
xmlns="http://www.w3.org/2000/svg"
width="400"
height="200"
preserveAspectRatio="xMidYMid slice">
<circle cx="100" cy="100" r="50" fill="blue" />
</svg>
js
const svgElement = document.querySelector("svg");
// Access the meetOrSlice property
console.log(svgElement.preserveAspectRatio.baseVal.meetOrSlice); // Output: 2 (SVG_MEETORSLICE_SLICE)
規範
| 規範 |
|---|
| Scalable Vector Graphics (SVG) 2 # __svg__SVGPreserveAspectRatio__meetOrSlice |
瀏覽器相容性
載入中…