字体大小。我可以确定什么? [英] Font size. What can I be sure of?

查看:174
本文介绍了字体大小。我可以确定什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

字体大小是什么意思?

让我们接受CSS。我有 font-size 其中我可以指定像素等。

那么, 12px 是什么意思? 20pt 是什么意思?它是字符的最大宽度,是最小宽度,是最大高度吗?

我将确定 font-size:10px 将不会超过 50px ,不小于那个,或者正好那个宽度?

= px = pt 定义字体大小。 strong>



注意:72 pt等于一英寸= 2,54厘米



屏幕的分辨率在px中定义。
显然,如果在px中定义font-size,则显示器上的像素越多,像素越小,因此字体越小。



那么,有什么区别呢?



当你看到它们在行动中时,很容易理解字体大小单位之间的区别。通常,1em = 12pt = 16px = 100%。使用这些字体大小时,让我们看看当您将基本字体大小(使用body CSS选择器)从100%增加到120%时会发生什么。





如您所见,并且百分比单位随着基本字体大小增加而增大,但像素和点不增大。您可以轻松设置文本的绝对大小,但访问者可以更轻松地使用可在任何设备或任何计算机上显示的可伸缩文本。因此, =http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/ =nofollow noreferrer> http://kyleschaeffer.com/best- practices / css-font-size-em-vs-px-vs-pt-vs /


What does font size actually mean?
Let's take CSS. I have font-size where I can specify a number in pixels, points etc.

So, what does 12px mean? And what does 20pt mean? Is it the maximum width of a character, is it the minimum one, is it the max height?
Will I know for sure that 5 characters of font-size: 10px will have no more than 50px, no less than that, or exactly that width?

解决方案

Commonly font-size is defined in pixels = px or points = pt

Note: 72 pt equals one inch = 2,54 cm

The resolution of a screen is defined in px. Obviously, the more pixels on a monitor of equal dimensions the smaller each pixel and hence the smaller the font size if font-size is defined in px.

So, What’s the Difference?

It’s easy to understand the difference between font-size units when you see them in action. Generally, 1em = 12pt = 16px = 100%. When using these font-sizes, let’s see what happens when you increase the base font size (using the body CSS selector) from 100% to 120%.

As you can see, both the em and percent units get larger as the base font-size increases, but pixels and points do not. It can be easy to set an absolute size for your text, but it’s much easier on your visitors to use scalable text that can display on any device or any machine. For this reason, the em and percent units are preferred for web document text.

Source: http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/

这篇关于字体大小。我可以确定什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆