Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayúdanos a traducirlo!
También puedes leer el artículo en English (US).

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

CategoriesNever-rendered element, Paint server element
Permitted contentAny 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="http://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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
hatch
Experimental
Chrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
hatchContentUnitsChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
hatchUnitsChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
hrefChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
pitchChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
rotateChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
transformChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
xChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?
yChrome No support NoEdge No support NoFirefox No support NoIE No support NoOpera No support NoSafari ? WebView Android ? Chrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS ? Samsung Internet Android ?

Legend

No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

Etiquetas y colaboradores del documento

Colaboradores en esta página: mdnwebdocs-bot, ExE-Boss, Sebastianz
Última actualización por: mdnwebdocs-bot,