X→ and Y↓ coordinate origin is upper left corner of the SVG viewBox
Since SVG is scalable the coordinate suffix px is not used.
The viewBox can have a background color or gradient. style="background-color: #303030;"
<svg> viewBox="0 0 100 100" style="width; 100;"> ⇒ 100%
<svg> viewBox="0 0 100 100" style="width; 50;"> ⇒ 50%
<g fill="white" stroke="green" stroke-width="5">
<circle cx="40" cy="40" r="25" />
<circle cx="60" cy="60" r="25" />
</g>
<defs>
<pattern id="hatch" viewBox="0,0,10,10" width="5%" height="20%">
<path d="M0,0 L10,10 M0,-10 L-10,10" stroke="#0088ff" stroke-width="1" />
<pattern id="cirhatch" viewBox="0,0,10,10" width="5%" height="20%">
<circle cx="5" cy="5" r="3" stroke="#0088ff" stroke-width="1" />
</pattern>
</defs>
<rect width="400" height="100" stroke="red" stroke-width="2" fill="url(#hatch)" />
The width & height % in the pattern definition is based on the width & height dimensions of the element filled.
<path d="M0,100 h400 v100 h-400 Z" stroke="red" stroke-width="2" fill="url(#cirhatch)" />
</svg>
<defs>
<path id="a_window" d="M0,0 h12 v16 h-12 Z " style="fill: red; stroke: cyan; stroke-width: 2;" />
</defs>
Then USE it anywhere inside <svg> this way:
<use xlink:href="#a_window" x="0" y="10" />
<use xlink:href="#a_window" x="30" y="10" />
<use xlink:href="#a_window" x="60" y="10" />
The default Transform Origin is 0,0
Best is to define the group centered on 0,0
Rotate <g transform="rotate(30 50 50)" rotate(degrees, center x, center y)
Rotate <g transform="rotate(30)" rotate(degrees)
Scale <g transform="scale(-1,1)" scale(horizontal, vertical)
<svg>
<use xlink:href="#screw" x="50" y="30" />
<defs>
<path id="screw" d="M0,0 m-10,0 a10,10 0 0 1 20,0 a10,10 0 0 1 -20,0 m3,7 l14,-14 " />
</defs>
</svg>
HORIZONTAL
By default, text is anchored at the left.
To center Horizontally use
text-anchor: "middle"
Best Practice for ALL SVG Identifiers is to use camelCase
Examples are:
firstName iPhone visaCard eMail myPath
DO NOT use numbers in the I.D.
1. Define the <path> within the <defs>, it must have a unique I.D. (id="myPath").
During development, it is best to give the path a color too, (style="stroke: #ff0000;")
2. In both <text> and <textpath> set these parameters as required (see sample code below)
dx=" " distance from start of the path
dy=" " baseline distance from the path, neg y = opposite side
fill: #ff0000; this is the Text Color (can also be a gradient: fill: url(#gradientName);
letter-spacing: 1px; adjust if needed
stroke-width: 0; Required
font: 28px times;
font-weight: bold; (optional)
3. In <defs> remove the path stroke color to hide the path (optional) style="stroke: none;"
<svg viewBox="0 0 960 200" style="width: 960; fill: none; stroke: #ff0000; stroke-width: 2; border: 1px solid #00ccff;"> <defs> <path id="myPath" d="M180,120 a240,240 0 0 1 300,0 a240,240 0 0 0 300,0 " /> </defs> <use xlink:href="#myPath" x="0" y="0" /> <text dx="20" dy="-6"> <textPath xlink:href="#myPath" style="font: 55px arial; letter-spacing: 1px; stroke-width: 0; fill: #ffffff;">Text on a Path Example </textPath> </text> </svg>
<defs>
<linearGradient id="sunSet" x1="0%" y1="0%" x2="90%" y2="90%">
<stop stop-color="red" offset="0%"/>
<stop stop-color="gold" offset="100%"/>
</linearGradient>
<radialGradient id="moonSet" x1="0%" y1="0%" x2="90%" y2="90%">
<stop offset="0%" stop-color="purple" />
<stop offset="100%" stop-color="white" />
</radialGradient>
<circle id="sun" r="50" fill="url(#sunSet)" />
<circle id="moon" r="50" fill="url(#moonSet)" />
</defs>
<use xlink:href="#sun" x="60" y="60" />
<use xlink:href="#moon" x="180" y="60" />
<svg>
<svg>
rotate="auto" rotate="auto-reverse" rotate=""
<circle r="5" fill="red" >
<animateMotion dur="10s" repeatCount="indefinite"
path="M20,50 C20,-50 180,150 180,50 C180-50 20,150 20,50 z" />
</circle>
</svg>
<path id="path1" d="M50,125 C 50,25 200,25 200,125" fill="none" stroke="#606060" stroke-width="4" />
<path d="M-10,-8 L10,-8 L 0,-40 z M0,-8 l0,60" fill="#00ff88" stroke="#ff9675" stroke-width="4" >
<animateMotion dur="6s" repeatCount="indefinite" rotate="auto" >
<mpath xlink:href="path1"/>
</animateMotion>
</path>
</svg>
Y↓
Art Deco Fan Element
<path d="M 120,240 Q 120,136 208,42" stroke="#ffa080" stroke-width="4" fill="none" />
<path d="M 2,120 A 1 1 0 0 1 238,120"
stroke="#ffa080" stroke-width="4" fill="none" />
<path d="M10,80 Q50,0 90,80 130,180 170,80" stroke="#ffa080" stroke-width="3" fill="none" />
File Transfer Protocal
Hyper Text Transfer Protocal Secure
Hyper Text Markup Language
Secure Hypertext Markup Language
Cascading Style Sheet
Scalable Vector Graphics
DIVision (of a webpage)
Inline CSS coding
A referenced CSS code defined by ".classname { }"
JavaScript
Open Graph (images originally for use in social media links)