Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/linking/reftests/svgview-preserveaspectratio.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>SVG fragment identifier: preserveAspectRatio() inside svgView()</title>
<link rel="help" href="https://w3c.github.io/svgwg/svg2-draft/linking.html#SVGFragmentIdentifiersDefinitions">
<link rel="match" href="svgview-teal-100x50-ref.html">
<meta name="assert" content="AspectParams in an svgView() specification are the parameter values of the preserveAspectRatio attribute. With preserveAspectRatio(none) a 1:1 view is stretched to fill a 2:1 box, so the box is filled edge to edge by the selected quadrant.">
<!--
support/squares.svg is 200x200 with four solid quadrants:
#d46847 terracotta | #2a9d8f teal
#264653 indigo | #e9c46a sand
viewBox(100,0,100,100) selects the teal quadrant, which is square, and the img is
2:1. Without preserveAspectRatio(none) the view would be letterboxed, so a flat
colour across the whole box is only possible if the second attribute took effect.
-->
<style>
body { margin: 0; }
img { display: block; border: none; }
</style>
<img src="support/squares.svg#svgView(viewBox(100,0,100,100);preserveAspectRatio(none))" width="100" height="50" alt="">