← Back to release summary

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

Ecosystem

View on chromestatus.com