Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1049778 of <pattern>

  • Revision slug: Web/SVG/Element/pattern
  • Revision title: <pattern>
  • Revision id: 1049778
  • Created:
  • Creator: Tigt
  • Is current revision? No
  • Comment Clarified intro paragraph and added links to `stroke` and `fill`

Revision Content

{{ SVGRefElem() }}

The pattern element defines a graphics object which can be redrawn at repeated x and y-coordinate intervals ("tiled") to cover an area. The <pattern> is referenced by the fill and/or stroke properties on other graphics elements to fill or stroke those elements with the referenced pattern.

Usage context

{{svginfo}}

Example

Source code Output result
{{ embed_text("pattern.svg", "xml") }} {{ EmbedSVG("pattern.svg",120,120) }}

» pattern.svg

Attributes

Global attributes

Specific attributes

  • {{ SVGAttr("patternUnits") }}
  • {{ SVGAttr("patternContentUnits") }}
  • {{ SVGAttr("patternTransform") }}
  • {{ SVGAttr("x") }}
  • {{ SVGAttr("y") }}
  • {{ SVGAttr("width") }}
  • {{ SVGAttr("height") }}
  • {{ SVGAttr("xlink:href") }}
  • {{ SVGAttr("preserveAspectRatio") }}

DOM Interface

This element implements the SVGPatternElement interface.

Specifications

Specification Status Comment
{{SpecName('SVG2', 'pservers.html#Patterns', '<pattern>')}} {{Spec2('SVG2')}}  
{{SpecName('SVG1.1', 'pservers.html#Patterns', '<pattern>')}} {{Spec2('SVG1.1')}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

{{SVGRef}}

Revision Source

<div>{{ SVGRefElem() }}</div>

<p><span class="seoSummary">The <strong><code>pattern</code></strong> element defines a graphics object which can be redrawn at repeated x and y-coordinate intervals ("tiled") to cover an area.</span> The <code>&lt;pattern&gt;</code> is referenced by the <code><a href="/en-US/docs/Web/SVG/Attribute/fill">fill</a></code> and/or <code><a href="/en-US/docs/Web/SVG/Attribute/stroke">stroke</a></code> properties on other <a href="/en-US/docs/Web/SVG/Tutorial/Basic_Shapes">graphics elements</a> to fill or stroke those elements with the referenced pattern.</p>

<h2 id="Usage_context">Usage context</h2>

<p>{{svginfo}}</p>

<h2 id="Example">Example</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Source code</th>
   <th scope="col">Output result</th>
  </tr>
  <tr>
   <td>{{ embed_text("pattern.svg", "xml") }}</td>
   <td>{{ EmbedSVG("pattern.svg",120,120) }}</td>
  </tr>
 </tbody>
</table>

<p>» <a href="https://developer.mozilla.org/files/3268/pattern.svg">pattern.svg</a></p>

<h2 id="Attributes">Attributes</h2>

<h3 id="Global_attributes">Global attributes</h3>

<ul>
 <li><a href="/en/SVG/Attribute#ConditionalProcessing">Conditional processing attributes</a> »</li>
 <li><a href="/en/SVG/Attribute#Core">Core attributes</a> »</li>
 <li><a href="/en/SVG/Attribute#Presentation">Presentation attributes</a> »</li>
 <li><a href="/en/SVG/Attribute#XLink">Xlink attributes</a> »</li>
 <li>{{ SVGAttr("class") }}</li>
 <li>{{ SVGAttr("style") }}</li>
 <li>{{ SVGAttr("externalResourcesRequired") }}</li>
 <li>{{ SVGAttr("viewBox") }}</li>
</ul>

<h3 id="Specific_attributes">Specific attributes</h3>

<ul>
 <li>{{ SVGAttr("patternUnits") }}</li>
 <li>{{ SVGAttr("patternContentUnits") }}</li>
 <li>{{ SVGAttr("patternTransform") }}</li>
 <li>{{ SVGAttr("x") }}</li>
 <li>{{ SVGAttr("y") }}</li>
 <li>{{ SVGAttr("width") }}</li>
 <li>{{ SVGAttr("height") }}</li>
 <li>{{ SVGAttr("xlink:href") }}</li>
 <li>{{ SVGAttr("preserveAspectRatio") }}</li>
</ul>

<h2 id="DOM_Interface">DOM Interface</h2>

<p>This element implements the <code><a href="/en/DOM/SVGPatternElement">SVGPatternElement</a></code> interface.</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('SVG2', 'pservers.html#Patterns', '&lt;pattern&gt;')}}</td>
   <td>{{Spec2('SVG2')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('SVG1.1', 'pservers.html#Patterns', '&lt;pattern&gt;')}}</td>
   <td>{{Spec2('SVG1.1')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE&nbsp;Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>{{SVGRef}}</p>
Revert to this revision