VOOZH about

URL: https://www.geeksforgeeks.org/html/svg-mask-attribute/

⇱ SVG mask Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

SVG mask Attribute

Last Updated : 31 Mar, 2022

The SVG mask attribute is used to bind an element in which this attribute is defined to with the given <mask> element. It has effect mostly on the following elements. <a>, <circle>, <clipPath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, and <use>.

Syntax:

mask = Keyword values

or

mask = Image values

or

mask = Global values

Attribute values: The mask attribute can be used with the following elements.

  • Keyword values: This attribute value includes values like none.
  • Image values: This attribute value uses pixel image or element within SVG graphic used as mask.
  • Global values: This attribute value includes values like inherit, initial, and unset.

Example 1:

Output:

👁 Image

Example 2:

Output:

👁 Image
Comment