目录

CSS font-stretch 属性


示例

使 <div> 元素中的文本更宽:

div {
  font-family: sans-serif, "Helvetica Neue", "Lucida Grande", Arial;
  font-stretch: expanded;
}


定义和用法

这个font-stretch属性允许您使文本变窄(压缩)或更宽(扩展)。

笔记:有些字体提供额外的字体;压缩面和扩展面。对于这些字体,您可以使用font-stretch属性来选择正常、压缩或扩展字体。

笔记:如果所选字体不提供压缩或扩展的字体,则此属性无效!

默认值: 普通的
遗传: 是的
可动画: 是的。阅读可动画的
版本: CSS3
JavaScript 语法: 对象.style.fontStretch="expanded"

浏览器支持

表中的数字指定完全支持该属性的第一个浏览器版本。

Property
font-stretch 48.0 9.0 9.0 11.0 35.0


语法

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

属性值

Value Description
ultra-condensed Makes the text as narrow as it gets
extra-condensed Makes the text narrower than condensed, but not as narrow as ultra-condensed
condensed Makes the text narrower than semi-condensed, but not as narrow as extra-condensed
semi-condensed Makes the text narrower than normal, but not as narrow as condensed
normal Default value. No font stretching
semi-expanded Makes the text wider than normal, but not as wide as expanded
expanded Makes the text wider than semi-expanded, but not as wide as extra-expanded
extra-expanded Makes the text wider than expanded, but not as wide as ultra-expanded
ultra-expanded Makes the text as wide as it gets
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit