Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ p {
- Legacy {{cssxref("font-stretch")}} alias property with better browser support
- {{cssxref("font-style")}} property
- {{cssxref("font-weight")}} property
- SVG {{SVGAttr("font-width")}} attribute
- SVG {{SVGAttr("font-stretch")}} attribute
- [Learn: Fundamental text and font styling](/en-US/docs/Learn_web_development/Core/Text_styling/Fundamentals)
- [CSS fonts](/en-US/docs/Web/CSS/Guides/Fonts) module
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ sidebar: svgref
The **`font-stretch`** attribute indicates the desired amount of condensing or expansion in the glyphs used to render the text.

> [!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.


You can use this attribute with the following SVG elements:

- {{SVGElement("text")}}
- {{SVGElement("textPath")}}
- {{SVGElement("tspan")}}

> [!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.

## Usage notes

<table class="properties">
Expand Down Expand Up @@ -50,4 +53,6 @@ You can use this attribute with the following SVG elements:

## See also

- CSS {{cssxref("font-stretch")}} property
- SVG {{SVGAttr("font-width")}} attribute (modern replacement)
- CSS {{cssxref("font-width")}} property
- CSS {{cssxref("font-stretch")}} property (legacy alias)
58 changes: 58 additions & 0 deletions files/en-us/web/svg/reference/attribute/font-width/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: font-width
slug: Web/SVG/Reference/Attribute/font-width
page-type: svg-attribute
status:
- experimental
browser-compat: svg.global_attributes.font-width
sidebar: svgref
---

{{SeeCompatTable}}

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.


You can use this attribute with the following SVG elements:

- {{SVGElement("text")}}
- {{SVGElement("textPath")}}
- {{SVGElement("tspan")}}

> [!NOTE]
> As a presentation attribute, `font-width` also has a CSS property counterpart: {{cssxref("font-width")}}. When both are specified, the CSS property takes priority.

## Usage notes

<table class="properties">
<tbody>
<tr>
<th scope="row">Value</th>
<td>See {{cssxref("font-width", "", "#formal_syntax")}}</td>
</tr>
<tr>
<th scope="row">Default value</th>
<td><code>normal</code></td>
</tr>
<tr>
<th scope="row">Animatable</th>
<td>Yes</td>
</tr>
</tbody>
</table>

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}

## See also

- CSS {{cssxref("font-width")}} property
- Legacy SVG {{SVGAttr("font-stretch")}} attribute
- CSS {{cssxref("font-stretch")}} property
2 changes: 2 additions & 0 deletions files/en-us/web/svg/reference/attribute/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Below is a list of all of the attributes available in SVG along with links to re
- {{SVGAttr("font-style")}}
- {{SVGAttr("font-variant")}}
- {{SVGAttr("font-weight")}}
- {{SVGAttr("font-width")}}
- {{SVGAttr("fr")}}
- {{SVGAttr("from")}}
- {{SVGAttr("fx")}}
Expand Down Expand Up @@ -361,6 +362,7 @@ All SVG presentation attributes can be used as CSS properties.
- {{SVGAttr("font-style")}}
- {{SVGAttr("font-variant")}}
- {{SVGAttr("font-weight")}}
- {{SVGAttr("font-width")}}
- {{SVGAttr("glyph-orientation-horizontal")}}
- {{SVGAttr("glyph-orientation-vertical")}}
- {{SVGAttr("height")}}
Expand Down