CSS font-stretch Property

CSS font-stretch Property

 

CSS font-stretch Property


The font-stretch property makes the text wider or narrower.

This property is one of the CSS3 properties.

No browser supports the font-stretch property.

The font-stretch property does not work on any font! It only works if the font-family has width-variant faces. The font-stretch property alone does not stretch a font.

This property has the following values:

  • font-stretch:
  • ultra-condensed
  • extra-condensed
  • condensed
  • semi-condensed
  • normal
  • semi-expanded
  • expanded
  • extra-expanded
  • ultra-expanded
Initial Valuenormal
Applies toAll elements. It also applies to ::first-letter and ::first-line.
InheritedYes.
AnimatableYes.
VersionCSS3
DOM Syntaxobject.style.fontStretch = "expanded";

Syntax

font-stretch: ultra-condensed | extra-condensed | condensed | semi-condensed | normal | semi-expanded | expanded | extra-expanded | ultra-expanded | initial | inherit;

Example of the font-stretch property: 



<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      p {
        font-size: 4em;
        font-family: 'Myriad Pro';
      }
    </style>
  </head>
  <body>
    <p>
      <span style="font-stretch: ultra-condensed">A</span>
      <span style="font-stretch: extra-condensed">A</span>
      <span style="font-stretch: condensed">A</span>
      <span style="font-stretch: semi-condensed">A</span>
      <span style="font-stretch: normal">A</span>
      <span style="font-stretch: semi-expanded">A</span>
      <span style="font-stretch: expanded">A</span>
      <span style="font-stretch: extra-expanded">A</span>
      <span style="font-stretch: ultra-expanded">A</span>
    </p>
  </body>
</html>

Selection of the font face

The face which is selected for the value of the font-stretch property relies on the faces that the font in question supports. If there is no face provided by the font, that matches the given value, the values that are less than 100% map to a narrower face, and the values that are greater or equal to 100 % map to a wider one.

Values

ValueDescription
ultra-condensedMakes the text as narrow as it gets.
extra-condensedMakes the text narrower but not as narrower as ultra-condesed value.
condensedMakes the text narrower but not as narrower as ultra-condesed value.
semi-condensedMakes the text narrower but not as narrower as extra-condensed value.
normalThere is no font stretching. This is the default value of this property.
semi-expandedMakes the text wider than normal.
expandedMakes the text wider than semi-expanded.
extra-expandedMakes the text wider than expanded.
ultra-expandedMakes the text as wide as it gets.
initialIt makes the property use its default value.
inheritIt inherits the property from its parents element.
Reactions

Post a Comment

0 Comments

close