HTML5 & Web APIs (50 Qs)•Part 3: Advanced Internals, Scale & Production Architecture (Senior / Lead)
HTML Canvas vs SVG: Architectural Trade-Offs.
senior LevelSystem Design
In Simple Words:
- SVG (Scalable Vector Graphics): XML-based vector format. Uses Retained Mode graphics; elements exist in the DOM as nodes, can be styled with CSS, and listen to click events. Scales infinitely without pixelation. Best for logos, icons, and charts with few elements.
- Canvas (
<canvas>): JavaScript raster API. Uses Immediate Mode graphics; draws pixels directly onto a bitmap with zero DOM overhead. High performance for games, complex 3D graphics (WebGL), and 100,000+ data points.