[英]Scaling fonts with css
What is the correct way to scale a font using css. 使用CSS缩放字体的正确方法是什么? And what about compatibility?
那兼容性呢? Maybe it would be better to customize the font file itself?
也许自定义字体文件本身会更好?
For example i need to scale Avenir font 116% vertical scale and 105% horizontal scale. 例如,我需要缩放Avenir字体116%的垂直比例和105%的水平比例。
You can use this to 您可以使用它来
HTML HTML
<p>
Hello
</p>
CSS CSS
p {
display:inline-block;
transform:scale(1,4);
-webkit-transform:scale(1,4);
-moz-transform:scale(1,4);
-ms-transform:scale(1,4);
-o-transform:scale(1,4);
}
You can change the scale(x,y) value according to your need considering you are changing the height and width differently (ie the ratio of Height:Width is not 1:1) 您可以根据需要更改scale(x,y)值,考虑到要更改的高度和宽度有所不同(即,Height:Width的比例不是1:1)
Two points for you. 两点给你。
Editing the Avenir font itself infringes the font license, you need to get permission from the font foundry for that. 编辑Avenir字体本身会侵犯字体许可,因此您需要获得字体代工厂的许可。
Second never stretch fonts, it looks so bad. 第二个永远不要拉伸字体,看起来太糟糕了。 When you stretch a font it messes up the stroke widths, horizontal strokes will become thinner than the vertical strokes and when you squish a font up the vertical strokes become thinner than the horizontal ones.
拉伸字体时,它会弄乱笔划的宽度,水平笔划会比垂直笔划变细,而当您压缩字体时,垂直笔划会比水平笔划变细。
So my answer is there is no correct way to do it. 所以我的答案是没有正确的方法来做。
If you need a condensed font there are plenty available for example: 如果需要压缩字体,则可以使用许多示例,例如:
https://www.google.com/fonts/specimen/Open+Sans+Condensed https://www.google.com/fonts/specimen/Open+Sans+Condensed
we can adjust by increasing the size of font like font-size:40px; 我们可以通过增加字体大小来进行调整,例如font-size:40px; and adjust it through line-height
并通过线高进行调整
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.