Html 更改字体高度和宽度

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32932288/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 18:18:45  来源:igfitidea点击:

Change font height and width

htmlcss

提问by cabralpinto

I have this thing I'm working on when I would like to change not the font-sizebut two properties that would change independently the width and height of the text. So when applying font-width: 50%to this:

当我不想更改font-size但会独立更改文本宽度和高度的两个属性时,我正在处理这件事。所以当申请font-width: 50%这个时:

enter image description here

在此处输入图片说明

The text would be stretched to half:

文本将被拉伸到一半:

enter image description here

在此处输入图片说明

Is this possible to do with CSS, also with the height property?

这可能与 CSS 以及 height 属性有关吗?

回答by user4642212

CSS3 transformhas the scalefunction for this:

CSS3transform具有以下scale功能:

p {
  display: inline-block;
  font-size: 32px;
  transform: scale(.5, 1);
}
<p>This is text.</p>

Use the two numbers in the function for X- and Y-axis respectively.

分别使用函数中的两个数字作为 X 轴和 Y 轴。

回答by Aakash

You can try scaling the font in x direction.

您可以尝试在 x 方向缩放字体。

p{
    -webkit-transform: scaleX(0.5);
    transform: scaleX(0.5);
}

--EDIT--

- 编辑 -

I see @Xufox alredy answered it.

我看到@Xufox 已经回答了。

回答by Fintan Creaven

The closest thing I can find is font-weight

我能找到的最接近的东西是 font-weight

It accepts not only bold,normal but also numeric values. 100-900 in 100 increments.

它不仅接受粗体、普通值,还接受数字值。100-900 以 100 为增量。

 . Paragraph {font-weight :700;}

This combined with height properties should help but will not give you complete solution

这与高度属性相结合应该会有所帮助,但不会为您提供完整的解决方案

Also look at spacing properties as you can reduce the the width of the words that way

还要查看间距属性,因为您可以通过这种方式减少单词的宽度

  letter-spacing: 2px;