본문 바로가기
svg

svg guide

by peach1227 2025. 8. 30.
SVG Reference Guide

SVG Reference Guide

Basic Shape Elements

ElementDescription
<rect>Rectangle
<circle>Circle
<ellipse>Ellipse
<line>Straight line
<polyline>Connected lines (open)
<polygon>Connected lines (closed)
<path>Complex shapes via path data

Presentation Attributes

  • fill, stroke, opacity
  • stroke-width, stroke-linecap, stroke-linejoin
  • font-family, font-size, text-anchor

DOM Hierarchy

Document
└── <svg> (SVGSVGElement)
    ├── <g> (SVGGElement)
    │   ├── <rect> (SVGRectElement)
    │   └── <circle> (SVGCircleElement)
    ├── <defs> (SVGDefsElement)
    │   └── <linearGradient> (SVGLinearGradientElement)
    ├── <text> (SVGTextElement)
    └── <path> (SVGPathElement)
  

tagName vs nodeName

PropertyApplies ToElement NodesOther Nodes
tagName Element nodes only "DIV", "SPAN" undefined
nodeName All node types "DIV", "SPAN" "#text", "#comment"

Why the # in nodeName?

The # prefix in nodeName indicates a non-element node type:

  • #text — Text node
  • #comment — Comment node
  • #document — Document node

🎨 Interactive SVG Examples

Hover over me
반응형

'svg' 카테고리의 다른 글

SVG Animation Playground  (0) 2025.08.30
paper.js eigenvalue,eigenvector:  (1) 2024.04.28
svg paper.js quadrant :  (0) 2024.04.21
svg paper.js astroid : area from Green's Theorem  (1) 2024.03.30
svg paper.js cycloid:  (0) 2024.03.22