view

<view>

<view>是查看图像的定义方式,如缩放级别或细节视图。

用法上下文

分类没有
允许的内容任意数量的以下元素,以任何顺序:描述性元素

属性

全局属性

  • Aria attributes »

  • Core attributes »

  • Global event attributes »

  • externalResourcesRequired

具体属性

  • viewBox

  • preserveAspectRatio

  • zoomAndPan

  • viewTarget

例子

SVG

<svg width="600" height="200" viewBox="0 0 600 200" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <radialGradient id="gradient"> <stop offset="0%" stop-color="#8cffa0" /> <stop offset="100%" stop-color="#8ca0ff" /> </radialGradient> </defs> <circle r="50" cx="180" cy="50" style="fill:url(#gradient)"/> <view id="halfSizeView" viewBox="0 0 1200 400"/> <view id="normalSizeView" viewBox="0 0 600 200"/> <view id="doubleSizeView" viewBox="0 0 300 100"/> <a xlink:href="#halfSizeView"> <text x="5" y="20" font-size="20">half size</text> </a> <a xlink:href="#normalSizeView"> <text x="5" y="40" font-size="20">normal size</text> </a> <a xlink:href="#doubleSizeView"> <text x="5" y="60" font-size="20">double size</text> </a> </svg>

结果

DOM接口

这个元素实现了SVGViewElement接口。

产品规格

SpecificationStatusComment
Scalable Vector Graphics (SVG) 2The definition of '<view>' in that specification.Candidate Recommendation
Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<view>' in that specification.RecommendationInitial definition

浏览器兼容性

FeatureChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support(Yes)(Yes)15.0 (15.0)No support(Yes)?

FeatureAndroidEdgeFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support?(Yes)15.0 (15.0)???