This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The <hatch>
SVG element is used to fill or stroke an object using one or more pre-defined paths that are repeated at fixed intervals in a specified direction to cover the areas to be painted.
Hatches defined by the <hatch>
element can then referenced by the fill
and stroke
CSS properties on a given graphics element to indicate that the given element shall be filled or stroked with the hatch. Paths are defined by <hatchpath>
elements.
Usage context
Categories | Never-rendered element, Paint server element |
---|---|
Permitted content | Any number of the following elements, in any order: Animation elements Descriptive elements <hatchpath> , <script> , <style> |
Attributes
Global attributes
Specific attributes
DOM Interface
This element implements the SVGHatchElement
interface.
Example
SVG
<svg width="200" height="200" xmlns="https://www.w3.org/2000/svg"> <defs> <hatch id="hatch" hatchUnits="userSpaceOnUse" pitch="5" rotate="135"> <hatchpath stroke="#a080ff" stroke-width="2"/> </hatch> </defs> <rect fill="url(#hatch)" stroke="black" stroke-width="2" x="10%" y="10%" width="80%" height="80%" /> </svg>
Result
Specifications
Specification | Status | Comment |
---|---|---|
Scalable Vector Graphics (SVG) 2 The definition of '<hatch>' in that specification. |
Candidate Recommendation | Initial definition |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | No support[1] | No support[2] | No support[3] | No support | No support[1] | ? |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | ?[1] | No support[3] | No support | No support | ? |
[1] Blink does not yet implement this feature. See Chromium bug 367762.
[2] EdgeHTML does not yet implement this feature. See Edge bug 9107381.
[3] Gecko does not yet implement this feature. See bug 1239147.