SVG <pattern> Element Last Updated : 31 Mar, 2022 Comments Improve Suggest changes Like Article Like Report SVG stands for Scalable Vector Graphic. It can be used to make graphics and animations in HTML canvas. The <pattern> element is used to fill shapes with patterns made up of images. It fills the shapes in a tiled fashion. Syntax: <pattern> . . . </pattern> Attributes: patternUnits: It defines the co-ordinates of x, y, height and width. patternContentUnits: It defines the region of the pattern. preserveAspectRatio: It shows an element with a viewBox giving a aspect ratio must fit into a viewport with a different aspect ratio. xlink:href: It defines a reference IRI to a resource. Example 1: HTML <!DOCTYPE html> <html> <body> <svg width="200" height="200"> <defs> <pattern id="pattern" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"> <circle cx="10" cy="10" r="10" style="stroke:lightgreen; fill:white" /> </pattern> </defs> <rect x="10" y="10" width="100" height="100" style="stroke: #000000; fill: url(#pattern);" /> <g fill="#FFFFFF" stroke="black" font-size="12" font-family="Verdana"> <text x="13" y="65"> GeeksForGeeks </text> </svg> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html> <body> <svg width="300" height="350"> <defs> <pattern id="in" x="2" y="2" width="6" height="6" patternUnits="userSpaceOnUse"> <rect x="2" y="2" width="4" height="8" stroke="green" fill="red" /> </pattern> <pattern id="out" x="13" y="13" width="50" height="50" patternUnits="userSpaceOnUse"> <circle cx="4" cy="4" r="18" stroke="black" stroke-width="4px" fill="url(#in)" /> </pattern> </defs> <rect x="1" y="5" width="200" height="200" stroke="green" fill="url(#out)" /> </svg> </body> </html> Output: Create Quiz Comment E epistler_999 Follow 0 Improve E epistler_999 Follow 0 Improve Article Tags : Web Technologies HTML HTML-SVG SVG-Element Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables9 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms4 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List5 min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like