Enhanced support for presentation attributes on <use> and <symbol> elements
- Category
- Miscellaneous
- Type
- New or changed feature
- Status
- On hold (Chrome On hold)
- Intent stage
- None
WPT details: WPTs in chromium: https://wpt.fyi/results/svg/struct/reftests/use-symbol-inline-css-001.svg https://wpt.fyi/results/svg/struct/reftests/use-symbol-inline-css-002.svg https://wpt.fyi/results/svg/struct/reftests/use-symbol-inline-css-003.svg https://wpt.fyi/results/svg/struct/reftests/use-svg-inline-css.svg
Summary
This feature ensures consistent rendering of the <use> element when using width and height via both CSS and presentation attributes. It also adds support for x, y, width, and height on <symbol>, giving developers better control over layout. Before: Only CSS-based width and height on <use> were supported; presentation attributes were ignored or inconsistent. Now: <use> supports width and height as presentation attributes. <symbol> supports x, y, width, and height as presentation attributes. This ensures consistent rendering across CSS and markup. Before: <svg width="100" height="100"> <defs> <symbol id="sym"> <rect width="100" height="100" fill="green"/> </symbol> </defs> <use href="#sym" style="width:40; height:40"/> </svg> Now: <svg width="100" height="100"> <defs> <symbol id="sym" width="80" height="80" x="10" y="10"> <rect width="100" height="100" fill="green"/> </symbol> </defs> <use href="#sym" width="40" height="40"/> </svg>
Motivation
SVG 2.0 specifies that both CSS and presentation attributes should apply to the <use> element and adding x, y, width, height attributes as presentation attributes on symbol element, aligning its behavior with other stylable SVG and HTML elements. This alignment is important for several reasons: Styling Flexibility: Developers can now use either CSS or markup to size <use> elements, improving maintainability and enabling responsive design patterns. Consistency Across Technologies: Supporting width and height as presentation attributes on <use>, and adding x, y, width, and height to <symbol>, aligns SVG behavior with HTML and other SVG elements, reducing confusion and simplifying development. Improved Developer Experience: Developers can rely on familiar styling mechanisms without needing workarounds, making SVG usage more intuitive and productive. Specification Compliance: This change ensures Chromium adheres more closely to the SVG 2.0 specification, promoting a standards-based and interoperable web platform. Overall, this enhancement improves layout control, simplifies authoring, and ensures consistent rendering across styling methods.
Standards & signals
- Specification: https://svgwg.org/svg2-draft/styling.html#TermPresentationAttribute
- Firefox: Neutral
- Safari: Neutral
- Web developers: Positive — 9 people have upvoted this in the chromium issue.
- Tracking bug: https://issues.chromium.org/issues/40377919
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=svg%2Fstruct%2Freftests%2Fuse-symbol-inline-css-001
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+Enhanced%20support%20for%20presentation%20attributes%20on%20%3Cuse%3E%20and%20%3Csymbol%3E%20elements
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=Enhanced%20support%20for%20presentation%20attributes%20on%20%3Cuse%3E%20and%20%3Csymbol%3E%20elements
- Baseline status: https://webstatus.dev/?q=Enhanced%20support%20for%20presentation%20attributes%20on%20%3Cuse%3E%20and%20%3Csymbol%3E%20elements