A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/svg/elements/pattern below:

pattern · WebPlatform Docs

pattern Summary

Defines a block of graphics which can be used as a repeating pattern tile to paint the fill or stroke of other elements.

Overview Table
DOM Interface
SVGElement
Examples

In the following code example, a pattern fills a circle. The pattern is made up of a repeated series of wedge-shaped paths. Copy this sample to a text file and save it with the .html file extension. Run it in Internet Explorer 9 to see the pattern-filled circle.

The pattern-filled circle will look like this:



<!DOCTYPE HTML>
<html>
  <head></head>
  <body>
    
    <svg width="400" height="400">
      
      <defs>
        
        <pattern id="myPattern" patternUnits="userSpaceOnUse" x="0" y="0" width="30" height="30" >
          
          <path d="M 0 10 L 25 30 L 50 30 Z" stroke="darkorchid"
                        stroke-width="3" fill="cornflowerblue" />
        </pattern>
      </defs>
      
      <circle cx="100" cy="100" r="75" stroke="forestgreen"
                stroke-width="3" fill="url(#myPattern)" />
    </svg>
  </body>
</html>
Notes Remarks

Note: In addition to the attributes, properties, events, methods, and styles listed above, SVG elements also inherent core HTML attributes, properties, events, methods, and styles.

You can use a pattern to fill or stroke an object by using a predefined graphic object that is replicated (that is, tiled) at fixed intervals along the x-axis and y-axis to cover the areas to be painted. You can define a pattern by using a pattern element. You can then reference the pattern by the fill and stroke properties on a given graphics element to specify that the given element is filled or stroked with the referenced pattern.

The x, y, width, height, and patternUnits attributes define a reference rectangle somewhere on the infinite SVG canvas. The reference rectangle has its upper-left corner at (x, y) and its lower-right corner at (x + width, y + height). The tiling theoretically extends a series of such rectangles to infinity along the x-axis (positive) and y-axis (negative), with rectangles starting at (x + m · width, y + n · height) for each possible m and n integer value.

For more information, see Scalable Vector Graphics (SVG) 1.0 Specification.

Standards information Members

The SVGPatternElement object has these events:

The SVGPatternElement object has these methods:

The SVGPatternElement object has these properties:

coordinate system onto the target coordinate system.

Related specifications
SVG 1.1
W3C Recommendation
Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4