字体大小单位 [英] Font Size units

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

问题描述

很抱歉,如果这个问题有点基础。


我一般用字母表示我的字体大小,最初用来处理

Macintosh / Windows字体大小差异(虽然我相信他们俩现在以相同的方式对待积分,至少在浏览器窗口内)。


有人建议应该使用ems允许浏览器增加或减少文本大小
。但是,我从来没有遇到麻烦

带像素。


这是最佳做法,为什么?


另外,我通常只为主体指定字体大小,其余的元素为百分比(例如h1 {font-size:200%;})。有什么建议吗?


谢谢,


马克

解决方案



Mark写道:


这是最佳做法,为什么?



搜索新闻组档案。这是一个_very_常见问题


另外,我通常只指定正文的字体大小,其余的

元素作为百分比(例如h1 {font-size:200%;})。有什么建议?



这很好 - 你是指定字体大小对于他们所有人来说。

百分比仍然是字体大小。


最佳做法是将字体大小设置为百分比或ems

(这些实际上是相同的)尽管使用百分比避免了一个

IE漏洞。


您所陈述的练习中最佳练习的唯一区别是

这些:


*始终以相对单位设置屏幕字体大小,例如em或%

,绝不以像素为单位。如果它们应该是不同的,那就是用户'

的选择,并留下它们。只使用绝对单位(点或毫米)

打印输出到具有清晰物理尺寸映射的设备。

即使这样也没必要 - 有人可能_want_一个大的文本副本。


*将正文文本的大小设置为1em或100%,并且不要与此相关,因为

它会杀死可用性所以。通常将其设置为< bodyis

最简单,但重要的是正文。主要的

内容最终为1em,不一定< body>


*不要远远低于1em,0.8em可以"小"甚至可能是
0.67em。更少的东西几乎可以保证是不可读的。


*你_might_将IE的默认大小设置为80%或70%,因为

那里'这是一个Windows错误,在Windows桌面显示中选择了大字体的高分辨率屏幕屏幕上显示默认大小。这个

是一个折衷方案,因为你正在破坏网站的lo-res

Windows用户。生活很糟糕,IE比大多数人都糟糕。


Mark写道:


对不起,如果这个问题有点基础。



经常被问到。


我一般用像素表示我的字体大小,原来是为了处理

Macintosh / Windows字体大小的差异(虽然我相信它们现在都是以相同的方式对待积分,至少在浏览器中是否为
窗口)。



积分用于打印。 IE

用户无法调整点数或像素数。


有人建议应该使用ems来允许浏览器

增加或减少文本大小。但是,我从来没有遇到麻烦

像素。



请邀请有视力障碍的人使用Internet Explorer,

然后,看看您的网站在尝试增加时会发生什么

字体到可读大小,对于他们来说。 (提示:没有任何反应。)


哪种是最佳做法,为什么?


另外,我通常指定字体大小仅适用于身体,其余部分为元素百分比(例如h1 {font-size:200%;})。任何

的建议?

http://k75s.home.att。 net / fontsize.html


-

-bts

-Motorcycles无视重力;汽车只是吮吸


感谢Beauregard& Andy对你的评论。


我对这些东西我还是有点模糊。


好​​的,所以em是一样的作为字体的磅值,或类似的东西

。这仍然是一个相对的字体大小。


如果我想要一个特定的字体大小会发生什么,而其他人想要

a不同的字体大小,至少开始。我们都想使用

相同的font-family。那么我们如何在ems中表达这一点呢?我看不出怎么

我不会以像素大小开始这个...?


Mark

Sorry if the question is a bit basic.

I generally express my font sizes in pixels, originally to handle the
Macintosh/Windows font size differences (though I believe that they both
now treat points the same way, at least within the browser window).

It has been suggested that one should use ems to allow browsers to
increase or decrease the text size. However, I have never had trouble
with pixels.

Which is best practice and why?

Also, I generally specify a font size for the body only, and the rest of
the elements as percentages (eg h1 { font-size: 200%; }). Any suggestions?

Thanks,

Mark

解决方案


Mark wrote:

Which is best practice and why?

Searching the newsgroup archives. This is a _very_ FAQ

Also, I generally specify a font size for the body only, and the rest of
the elements as percentages (eg h1 { font-size: 200%; }). Any suggestions?

That''s fine -- you''re "specifying font sizes" for all of them here. A
percentage is still a font size.

Best practice is to set the font size in either percentages or ems
(these are effectively the same) although using percentages avoids an
IE bug.

The only differences of best practice from your stated practice are
these:

* Always set the screen font sizes in relative units such as em or %
and never in pixels. If they ought to be different, that''s the user''s
choice and leave it with them. Only use absolute units (points or mm)
for printed output to a device with a clear physical mapping of sizes.
Even then it''s unnecessary -- someone might _want_ a large text copy.

* Set the size of body text to 1em or 100% and DO NOT MESS WITH THIS as
it kills usability to do so. Generally setting it for <bodyis
easiest, but the important thing is that the "body text" of the main
content ends up as 1em, not necessarily <body>

* Don''t go far below 1em, 0.8em is OK for "small" and maybe even
0.67em. Anything less is pretty much guaranteed to be unreadable.

* You _might_ set the default size to 80% or 70% for IE alone, as
there''s a Windows bug that screws up the default size on high-res
screens with large fonts selected in the Windows desktop display. This
is a compromise though, because you are breaking the site for lo-res
Windows users. Life sucks, and IE sucks more than most.


Mark wrote:

Sorry if the question is a bit basic.

Asked often.

I generally express my font sizes in pixels, originally to handle the
Macintosh/Windows font size differences (though I believe that they
both now treat points the same way, at least within the browser
window).

Points are for printing. Neither points nor pixels are resizable by IE
users.

It has been suggested that one should use ems to allow browsers to
increase or decrease the text size. However, I have never had trouble
with pixels.

Please invite a person with impaired vision to use Internet Explorer,
then, and see what happens with your site when they attempt to increase
the font to a readable size, for them. (Hint: nothing happens.)

Which is best practice and why?

Also, I generally specify a font size for the body only, and the rest
of the elements as percentages (eg h1 { font-size: 200%; }). Any
suggestions?

http://k75s.home.att.net/fontsize.html

--
-bts
-Motorcycles defy gravity; cars just suck


Thanks Beauregard & Andy for your comments.

I''m still a bit fuzzy on these em things.

OK, so an em is the same as the point size of the font, or something
like that. That''s still a relative font size.

What happens if I want a particular font size, while somebody else wants
a different font size, at least to start off with. We both want to use
the same font-family. So how do we express this in ems? I can''t see how
I wouldn''t start this with a size in pixels ... ?

Mark


这篇关于字体大小单位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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