font-stretch

CSS font-stretch Property

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

This property is one of the CSS3 properties.

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.
Inherited
AnimatableYes.
VersionCSS3
DOM Syntaxobject.style.fontStretch = “expanded”;

Syntax

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

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

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.


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部