Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is font-stretch:condensed an invalid property value in Google Chrome?

I am trying to use font-stretch:condensed and it shows as invalid in Google Chrome Developer tools when inspecting it.

enter image description here

It renders fine in Firefox.

like image 438
DarknessBeginsHere Avatar asked Sep 11 '13 23:09

DarknessBeginsHere


People also ask

Why is font-stretch not working?

In order to use font-stretch and see a result of some kind, the font being used has to have a face that matches the value given. In other words, font-stretch will not work on just any font, but only on fonts that are designed with different faces matching the defined sizes.

What is a valid value for the font-stretch attribute?

A <percentage> value between 50% and 200% (inclusive). Negative values are not allowed for this property.

What does font-stretch mean in CSS?

The font-stretch property allows you to make text narrower (condensed) or wider (expanded). Note: Some fonts provide additional faces; condensed faces and expanded faces. For these fonts, you can use the font-stretch property to select a normal, condensed, or expanded font face.


2 Answers

There is no support to font-stretch in Chrome yet.

The Developer tools misrepresent the situation: it is the property font-stretch that is “invalid” to Chrome, i.e. not supported by Chrome, not just the particular value condensed. However, Chrome recognizes the name; if you declare foo: bar, then the tools tell that foo is an unknown property name.

As a workaround, declare the condensed typeface you wish to use as the value of font-family, i.e. as if it were a font family and not just a particular typeface in a family. For example, instead of

font-family: Bodoni MT;
font-stretch: condensed;

(which works in IE 10, but not in Chrome or Firefox, although the latter claims to support font-stretch) you would write

font-family: Bodoni MT Condensed;

The specific name of the typeface must be either its PostScript name or its full name, as given in the names table in the font file corresponding to nameID values 4 and 6. You can find out this data using DTL OTMaster Light.

Note that using a specific typeface is the same thing that font-stretch does by definition, see CSS Fonts Module Level 3 LC. The name font-stretch is a misnomer; the property does not stretch a font – it only selects a typeface with the given width when such a typeface exists.

like image 180
Jukka K. Korpela Avatar answered Sep 24 '22 03:09

Jukka K. Korpela


The font-stretch property isn't part of any final standard and Chrome doesn't support it. See font-stretch on MDN.

like image 40
hobbs Avatar answered Sep 23 '22 03:09

hobbs