-
Notifications
You must be signed in to change notification settings - Fork 23.1k
Add font-width property and descriptor #42935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Preview URLs (6 pages)
Flaws (18)Note! 2 documents with no flaws that don't need to be listed. 🎉 Found an unexpected or unresolvable flaw? Please report it here. URL:
URL:
URL:
URL:
External URLs (8)URL:
URL:
URL:
URL:
(comment last updated: 2026-01-28 11:50:53) |
chrisdavidmills
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, @pepelsbey. I've got a bunch of comments for you to check over.
| - {{cssxref("font-size")}} | ||
| - {{cssxref("font-size-adjust")}} | ||
| - {{cssxref("font-stretch")}} | ||
| - {{cssxref("font-width")}} and its legacy alias {{cssxref("font-stretch")}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: In such cases, don't we usually tend to remove the legacy alias pages, redirect them towards the new name pages, and then cover the legacy name in the BCD for the new name (with "alternative name") and in the page description if we need to say something more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it’s a special case: adoption and browser support for the legacy property are so big, compared to the modern one, that it’s much more practical to use the legacy one. So most of the developers (and search engines) will start looking for the font-stretch.
Only when the font-width becomes widely supported and used, should we start considering redirecting the font-stretch.
files/en-us/web/css/reference/at-rules/@font-face/font-stretch/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/reference/at-rules/@font-face/font-width/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/reference/at-rules/@font-face/font-width/index.md
Outdated
Show resolved
Hide resolved
files/en-us/web/css/reference/at-rules/@font-face/font-width/index.md
Outdated
Show resolved
Hide resolved
Co-authored-by: Chris Mills <[email protected]>
|
I agree with @chrisdavidmills: we should delete and redirect the page. As long as the legacy alias is mentioned, it will show up in search engines and site search. Maintaining two pages that document the exact same feature is inviting for more confusion and bugs. This approach has been taken many times in the past and this should be no exception. |
|
The problem with keeping only the We're not changing the rules here. The whole situation is a big exception made by CSSWG, which renamed a CSS feature with a long history and wide adoption. Not a good idea, if you ask me. Oh well. And this is an exception for us as well, and it's only two pages to keep in sync. One of them has an expiration date on it. The moment |
|
OK, but we document new things with no legacy fallback just fine? Legacy fallback is an engineering decision that's not up for us to decide or even recommend. This is even transparent to most developers because postcss would handle it. |
Hrm, I agree that this is a bit of an exception. Usually, when we delete and redirect to the new name page, it is due to a change made to a fairly new feature that hasn't had such a history of widespread adoption. This being the case, I am OK with it, although I think we should explain the situation a bit more clearly, and provide examples, so maybe:
I wouldn't say this is |
I don’t think there’s one yet. Both the most popular PostCSS-based tools currently do nothing for the |
|
@chrisdavidmills, I synchronized your suggestions for
|
chrisdavidmills
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pepelsbey a few more comments; nearly there!
| font-width: 100%; | ||
| font-width: 200%; | ||
|
|
||
| /* multiple values */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* multiple values */ | |
| /* Multiple values */ |
For consistency with the previous comment. This needs changing on the font-stretch descriptor page too.
| sidebar: cssref | ||
| --- | ||
|
|
||
| The **`font-width`** [CSS](/en-US/docs/Web/CSS) descriptor allows authors to specify a normal, condensed, or expanded face for the fonts specified in the {{cssxref("@font-face")}} at-rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this page needs a similar note to the one you've got at the start of the font-width page to explain the relationship between the two, but probably tweaked so that it makes sense for this page.
|
|
||
| ## Examples | ||
|
|
||
| ### Setting a percentage range for font-width |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this example be expanded so that it also incorporates font-stretch in a sensible way to provide backwards compat? If not, maybe include a note about the potential compat issues, and what to do about it.
| > The `font-stretch` property was renamed to `font-width` in the [CSS Fonts specification](https://drafts.csswg.org/css-fonts/#font-stretch-prop). To preserve compatibility, the specification retains `font-stretch` as an alias for the `font-width` property. | ||
| > The `font-stretch` property was renamed to {{cssxref("font-width")}} in the [CSS Fonts specification](https://drafts.csswg.org/css-fonts/#font-stretch-prop). To preserve compatibility, the specification retains `font-stretch` as a legacy alias for the `font-width` property. | ||
|
|
||
| The **`font-stretch`** [CSS](/en-US/docs/Web/CSS) property selects a normal, condensed, or expanded face from a font. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Syntax section, replace the comment
/* <font-stretch-css3> keyword values */
with
/* Keyword values */
Again, <font-stretch-css3> is a spec detail that I don't think is very useful to mention on this page.
| @@ -96,11 +95,11 @@ This property may be specified as a single `<font-stretch-css3>` keyword value o | |||
| ### Values | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the line above this one, replace
This property may be specified as a single
<font-stretch-css3>keyword value or a single
with
This property may be specified as a single keyword or
| sidebar: cssref | ||
| --- | ||
|
|
||
| The **`font-width`** [CSS](/en-US/docs/Web/CSS) property selects a normal, condensed, or expanded face from a font. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I think this needs a similar note to the font-stretch property page, to explain the relationship between the two
|
|
||
| {{EmbedLiveSample('Font face selection', "100%", "250px")}} | ||
|
|
||
| A browser rendering of the above example in case your browser doesn't support `font-width` property: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| A browser rendering of the above example in case your browser doesn't support `font-width` property: | |
| The following screenshot shows how the above table is rendered, in case your browser doesn't support the `font-width` property: |
|
|
||
| ## Examples | ||
|
|
||
| ### Setting font width percentages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, would it make sense to include font-stretch fallbacks here, along with a bit of explanation as to why they are currently needed? The reader could then choose to include them in their CSS, or dynamically as part of their build process, or whatever.
I think your notes at the start of the articles do a good enough job. |
Description
font-widthproperty and descriptor pages, mostly duplicating existingfont-stretchonesfont-widthandfont-stretchdescriptor examples with live samplesMotivation
Support added in Safari for
font-widthproperty (Safari 18.4, March 2025)font-widthdescriptor (Safari 26, September 2025).Related issues and pull requests
Fixes #42409 and one item from the openwebdocs/project#234 list