Skip to content

Add font-width SVG attribute#43567

Open
pepelsbey wants to merge 1 commit intomdn:mainfrom
pepelsbey:font-stretch-width-svg
Open

Add font-width SVG attribute#43567
pepelsbey wants to merge 1 commit intomdn:mainfrom
pepelsbey:font-stretch-width-svg

Conversation

@pepelsbey
Copy link
Copy Markdown
Member

Description

  • Adds font-width SVG attribute (only supported in Safari 18.4 for now)
  • Mention font-width as a modern alias at font-stretch SVG attribute page

Motivation

  • Add missing attribute
  • Clarify legacy/modern status

Related issues and pull requests

@pepelsbey pepelsbey requested a review from a team as a code owner March 24, 2026 14:46
@pepelsbey pepelsbey requested review from hamishwillee and removed request for a team March 24, 2026 14:46
@github-actions github-actions bot added Content:CSS Cascading Style Sheets docs Content:SVG SVG docs size/m [PR only] 51-500 LoC changed labels Mar 24, 2026
@pepelsbey
Copy link
Copy Markdown
Member Author

@herrstrietzel does it address the issue you filed? Thanks.

@github-actions
Copy link
Copy Markdown
Contributor

Preview URLs (4 pages)

Flaws (10)

Note! 3 documents with no flaws that don't need to be listed. 🎉

Found an unexpected or unresolvable flaw? Please report it here.

URL: /en-US/docs/Web/SVG/Reference/Attribute
Title: SVG Attribute reference
Flaw count: 10

  • macros:
    • Macro svgattr produces link /en-US/docs/Web/SVG/Reference/Attribute/hreflang which doesn't resolve
    • Macro svgattr produces link /en-US/docs/Web/SVG/Reference/Attribute/offset which doesn't resolve
    • Macro svgattr produces link /en-US/docs/Web/SVG/Reference/Attribute/ping which doesn't resolve
    • Macro svgattr produces link /en-US/docs/Web/SVG/Reference/Attribute/referrerPolicy which doesn't resolve
    • Macro svgattr produces link /en-US/docs/Web/SVG/Reference/Attribute/rel which doesn't resolve
    • and 5 more flaws omitted

The **`font-width`** attribute selects a normal, condensed, or expanded face from a font family for the glyphs used to render the text.

> [!NOTE]
> The `font-width` attribute is the modern replacement for the deprecated {{SVGAttr("font-stretch")}} attribute. While `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except it wont be deprecated if mdn/browser-compat-data#29330 goes in.

Maybe

Suggested change
> The `font-width` attribute is the modern replacement for the deprecated {{SVGAttr("font-stretch")}} attribute. While `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.
> The `font-width` attribute is replacing the {{SVGAttr("font-stretch")}} attribute. While `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.


> [!NOTE]
> As a presentation attribute, `font-stretch` also has a CSS property counterpart: {{cssxref("font-stretch")}}. When both are specified, the CSS property takes priority.
> The `font-stretch` attribute was renamed to {{SVGAttr("font-width")}} following the renaming of the corresponding CSS property. The {{cssxref("font-stretch")}} CSS property is now a legacy alias for the {{cssxref("font-width")}} property. While `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming kind of implies that the old version doesn't exist which is not the case. This might be a cleaner approach.

Suggested change
> The `font-stretch` attribute was renamed to {{SVGAttr("font-width")}} following the renaming of the corresponding CSS property. The {{cssxref("font-stretch")}} CSS property is now a legacy alias for the {{cssxref("font-width")}} property. While `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.
> The `font-stretch` attribute was updated to {{SVGAttr("font-width")}}, and is now a legacy alias of that attribute. This follows an update of the corresponding CSS property {{cssxref("font-stretch")}} to {{cssxref("font-width")}}. Note that while `font-width` is the specification's preferred name, `font-stretch` currently has broader browser support.

Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pepelsbey - two suggestions - https://github.com/mdn/content/pull/43567/changes#r2997989422 should be fixed because the statement won't be true. Obviously I like the other too, but that's at your discretion.

Set as approved so you aren't blocked by me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:CSS Cascading Style Sheets docs Content:SVG SVG docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

font-stretch vs font-width SVG attribute: clarify the renaming

3 participants