W3cubDocs

/SVG

<view>

A view is a defined way to view the image, like a zoom level or a detail view.

Usage context

Categories None
Permitted content Any number of the following elements, in any order:
Descriptive elements

Attributes

Global attributes

Specific attributes

Example

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>

Result

DOM Interface

This element implements the SVGViewElement interface.

Specifications

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes 15 No Yes ?
preserveAspectRatio ? ? ? ? ? ?
viewBox ? ? ? ? ? ?
viewTarget ? ? ? ? ? ?
zoomAndPan ? ? ? ? ? ?
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support ? Yes Yes 15 ? ? ?
preserveAspectRatio ? ? ? ? ? ? ?
viewBox ? ? ? ? ? ? ?
viewTarget ? ? ? ? ? ? ?
zoomAndPan ? ? ? ? ? ? ?

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/view