font-stretch percentage values rejected by Validator

For technical support and bug reports for all editions of CSS HTML Validator, including htmlval for Linux and Mac.
TomHTML
Rank III - Intermediate
Posts: 75
Joined: Sun Feb 04, 2018 10:19 am

font-stretch percentage values rejected by Validator

Post by TomHTML »

I'm using the Inconsolata Google font retrieved here:

https://fonts.googleapis.com/css?family ... olata:400

This retrieves 3 @fontface blocks, each like this:

Code: Select all

@font-face {
  font-family: 'Inconsolata';
  font-style: normal;
  font-weight: 400;
  font-stretch: 100%;
  src: url(https://fonts.gstatic.com/s/inconsolata/v19/QldgNThLqRwH-OJ1UHjlKENVzkWGVkL3GZQmAwLYxYWI2qfdm7Lpp4U8WR32lw.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
The Validator objects to font-stretch: 100%, reporting:
The "font-stretch" descriptor has an invalid value "100%". This descriptor must have one of the following values: "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", or "ultra-expanded".
And:
A CSS error was found that may cause ambiguities and inconsistent presentations of the page [A, 4.1.1; G134]. Visit https://www.w3.org/TR/WCAG20-TECHS/G134 for more information. Details: The "font-stretch" descriptor has an invalid value "100%". This descriptor must have one of the following values: "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "semi-expanded", "expanded", "extra-expanded", or "ultra-expanded".
But the MDN documentation at https://developer.mozilla.org/en-US/doc ... nt-stretch claims percentages are fine:
/* Keyword values */
font-stretch: ultra-condensed;
font-stretch: extra-condensed;
font-stretch: condensed;
font-stretch: semi-condensed;
font-stretch: normal;
font-stretch: semi-expanded;
font-stretch: expanded;
font-stretch: extra-expanded;
font-stretch: ultra-expanded;

/* Percentage values */
font-stretch: 50%;
font-stretch: 100%;
font-stretch: 200%;

/* Global values */
font-stretch: inherit;
font-stretch: initial;
font-stretch: unset;
I'm using the current version of the Validator (2020 Home). Is this a bug?
User avatar
Albert Wiersch
Site Admin
Posts: 3785
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX

Re: font-stretch percentage values rejected by Validator

Post by Albert Wiersch »

Hi Tom,

I guess you could say this is a bug because it needs to be updated. It looks like <percentage> values were added in CSS Fonts Module Level 4 and all current browsers except for the Internet Explorer support <percentage> values for font-stretch.

I'll get this updated for the next CSS HTML Validator update.

UPDATE: Done! Fix will be in the next release.

Thanks!
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial