patternContentUnits

  • Revision slug: SVG/Attribute/patternContentUnits
  • Revision title: patternContentUnits
  • Revision id: 50743
  • Created:
  • Creator: Jeremie
  • Is current revision? No
  • Comment page created, 237 words added

Revision Content

« SVG Attribute reference home

The patternContentUnits attribute defines the coordinate system for the contents of the {{ SVGElement("pattern") }}. Note that this attribute has no effect if attribute {{ SVGAttr("viewBox") }} is specified on the {{ SVGElement("pattern") }} element.

If the patternContentUnits attribute isn't specified, then the effect is as if a value of userSpaceOnUse were specified.

Note that values defined as a percentage inside the content of the {{ SVGElement("pattern") }} are not affected by this attribute. It means that even if you set the value of patternContentUnits to objectBoundingBox, percentage values will be calculated as if the value of the attribute were userSpaceOnUse.

Usage context

Categories None
Value userSpaceOnUse | objectBoundingBox
Animatable Yes
Normative document SVG 1.1 (2nd Edition)
userSpaceOnUse
The user coordinate system for the contents of the {{ SVGElement("pattern") }} element is the coordinate system that results from taking the current user coordinate system in place at the time when the {{ SVGElement("pattern") }} element is referenced (i.e., the user coordinate system for the element referencing the {{ SVGElement("pattern") }} element via a {{ SVGAttr("fill") }} or {{ SVGAttr("stroke") }} attribute) and then applying the transform specified by attribute {{ SVGAttr("patternTransform") }}.
objectBoundingBox
the user coordinate system for the contents of the {{ SVGElement("pattern") }} element is established using the bounding box of the element to which the pattern is applied and then applying the transform specified by attribute {{ SVGAttr("patternTransform") }}.

Examples

Elements

The following elements can use the patternContentUnits attribute:

  • {{ SVGElement("pattern") }}

Revision Source

<p>« <a href="/en/SVG/Attribute" title="en/SVG/Attribute">SVG Attribute reference home</a></p>
<p>The <code>patternContentUnits</code> attribute defines the coordinate system for the contents of the {{ SVGElement("pattern") }}. Note that this attribute has no effect if attribute {{ SVGAttr("viewBox") }} is specified on the {{ SVGElement("pattern") }} element.</p>
<p>If the <code>patternContentUnits</code> attribute isn't specified, then the effect is as if a value of <code>userSpaceOnUse</code> were specified.</p>
<p>Note that values defined as a percentage inside the content of the {{ SVGElement("pattern") }} are not affected by this attribute. It means that even if you set the value of <code>patternContentUnits</code> to <code>objectBoundingBox</code>, percentage values will be calculated as if the value of the attribute were <code>userSpaceOnUse</code>.</p>
<h2 id="Usage_context">Usage context</h2>
<table class="standard-table"> <tbody> <tr> <th scope="row">Categories</th> <td><em>None</em></td> </tr> <tr> <th scope="row">Value</th> <td><code>userSpaceOnUse</code> | <code><strong>objectBoundingBox</strong></code></td> </tr> <tr> <th scope="row">Animatable</th> <td>Yes</td> </tr> <tr> <th scope="row">Normative document</th> <td><a class="external" href="http://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternContentUnitsAttribute" title="http://www.w3.org/TR/SVG11/pservers.html#PatternElementPatternContentUnitsAttribute">SVG 1.1 (2nd Edition)</a></td> </tr> </tbody>
</table>
<dl> <dt>userSpaceOnUse</dt> <dd>The user coordinate system for the contents of the {{ SVGElement("pattern") }} element is the coordinate system that results from taking the current user coordinate system in place at the time when the {{ SVGElement("pattern") }} element is referenced (i.e., the user coordinate system for the element referencing the {{ SVGElement("pattern") }} element via a {{ SVGAttr("fill") }} or {{ SVGAttr("stroke") }} attribute) and then applying the transform specified by attribute {{ SVGAttr("patternTransform") }}.</dd> <dt>objectBoundingBox</dt> <dd>the user coordinate system for the contents of the {{ SVGElement("pattern") }} element is established using the bounding box of the element to which the pattern is applied and then applying the transform specified by attribute {{ SVGAttr("patternTransform") }}.</dd>
</dl>
<h2 id="Examples">Examples</h2>
<h2 id="Elements">Elements</h2>
<p>The following elements can use the <code>patternContentUnits</code> attribute:</p>
<ul> <li>{{ SVGElement("pattern") }}</li>
</ul>
Revert to this revision