CSS字体:检测字体DPI使用特定的CSS [英] CSS Fonts: Detect Font DPI use specific CSS

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

问题描述

大家好,


我遇到了一些CSS和字体DPI的有趣问题,而且
肯定会欢迎帮助。


问题:

CSS中定义的页面布局有字体大小问题(重叠框架,文本

溢出弹出窗口等等)在Windows系统上使用120dpi

字体(大字体),但96dpi小字体的一切看起来都很完美。


我的问题是这个,有没有检测系统字体大小的方法,并为每个案例选择一个合适的CSS样式?部署是幻灯片放映。比如

课件解决方案显示在弹出窗口中 - 溢出不是

选项,因为窗口无法滚动。


大小为8.5pt的字体在96dpi时完美显示,但是在
120dpi时太大了。使用绝对a.o.2相对类型大小的原因是

..bodycopy定义了站点范围内的核心类型。如果设置为relative,则在某些情况下输入

非常小。


如果有人知道解决方案或检测系统字体的可能方法

dpi - 不是分辨率 - 我会非常感激。


提前致谢!


David

Hi All,

I''ve run into a bit of an interesting problem with CSS and font DPI and
would certainly welcome help.

Problem:
Page layout defined in CSS has font size issues (overlapping frames, text
overflowing out of popup window, etc) on a windows systems using 120dpi
fonts (large fonts), but everything looks perfect in 96dpi small fonts.

My question is this, is there a way to detect system font size and select an
appropriate CSS style for each case? The deployment is a "slideshow" like
courseware solution that is displayed in a popup window - overflow is not an
option as the window can not scroll.

Fonts sized at 8.5pt display perfectly in 96dpi but are much too large in
120dpi. The reason for using absolute a.o.2 relative type size is that
..bodycopy defines core type site-wide. If it is set to relative, type gets
insanely small in some cases.

If anyone knows of a solution or a possible method of detecting system font
dpi - not resolution - I would be very grateful.

Thanks in advance!

David

推荐答案

David Jubinville写道:
David Jubinville wrote:
有没有办法检测系统字体大小
is there a way to detect system font size




编号但你仍然可以通过神奇的1em使用这个字体大小。


font-size:100%; / *这会将字体大小设置为1em,或者确切地说是用户

在他或她的系统上配置的内容* /

max-width:10em; / *这将最大宽度设置为

用户选择的字体大小的10倍* /

-

Brian(删除无效给我发电子邮件)



No. But you can still work with that font size via the magical 1em.

font-size: 100%; /* this sets font size to 1em or exactly what the user
has configured on his or her system */

max-width: 10em; /* this sets the maximum width to 10 times the the
user''s chosen font size */
--
Brian (remove "invalid" to email me)


" David Jubinville" < DJ ********* @ rogers.nospam.com>在留言中写道

news:t9 ******************** @ rogers.com ...
"David Jubinville" <dj*********@rogers.nospam.com> wrote in message
news:t9********************@rogers.com...
你好全部,
字体大小为8.5pt,完全显示在96dpi,但在120dpi时太大了。使用绝对a.o.2相对类型大小的原因是
.bodycopy在站点范围内定义核心类型。如果设置为相对,则类型在某些情况下会变得非常小。

如果有人知道解决方案或可能的检测系统的方法
字体
dpi - 不是解决方案 - 我会非常感激。
Hi All, Fonts sized at 8.5pt display perfectly in 96dpi but are much too large in
120dpi. The reason for using absolute a.o.2 relative type size is that
.bodycopy defines core type site-wide. If it is set to relative, type gets
insanely small in some cases.

If anyone knows of a solution or a possible method of detecting system
font
dpi - not resolution - I would be very grateful.




我解决了这个问题(类型变得非常小)前一段时间,使用这个

技巧:而不是使用px或pt指定字体大小(这是不好的

,原因我不应该重复),而不是使用%或指定字体

大小em(通常建议使用,但可能会导致类型太小的问题),我反而使用标准的CSS字体大小

xx-small,x-small ,小,中,大,x大,和xx大。默认的

字体大小是中等的(除了IE,它很小,但可以使用CSS技巧绕过
),并且可以通过以下方式生成更小的尺寸

下降到小,x小等等。


在我的标准CSS文件中,我通常这样做:


@import url(style_std.css);


并且在导入的CSS文件中我有这个表单的代码来设置字体大小:


big {font-size:small; voice-family:" \"} \"" ;;

voice-family:inherit;字体大小:介质; }

html,p,li {font-size:x-small; voice-family:" \"} \"" ;;

voice-family:inherit;字体大小:小; }

small,代码{font-size:xx-small; voice-family:" \"} \"" ;;

voice-family:inherit;字体大小:X-小; }


古董浏览器永远不会看到这个(因为@import); '{''用于IE之后指定的第一个大小

;对于符合标准的浏览器,''}'之前指定的最后一个大小是

,语音家族技巧确保

IE看不到它。




I solved this problem (type gets insanely small) some time ago, using this
technique: instead of specifying font sizes using px or pt (which is bad
for reasons I should not have to repeat), and instead of specifying font
sizes using % or em (which is generally recommended, but which can result in
the type too small problem), I instead use the standard CSS font sizes
xx-small, x-small, small, medium, large, x-large, and xx-large. The default
font size is medium (except for IE, for which it is small, but which can be
circumvented using CSS trickery), and smaller sizes can be produced by
dropping down to small, x-small, etc.

In my standard CSS file I typically do:

@import url(style_std.css);

and in the imported CSS file I have code of this form to set the font sizes:

big { font-size:small; voice-family: "\"}\"";
voice-family:inherit; font-size:medium; }
html, p, li { font-size:x-small; voice-family: "\"}\"";
voice-family:inherit; font-size:small; }
small, code { font-size:xx-small; voice-family: "\"}\"";
voice-family:inherit; font-size:x-small; }

Antique browsers never see this (because of the @import); the first size
specified after the ''{'' is for IE; the last size specified before the ''}'' is
for standards-compliant browsers, with the voice-family trick to ensure that
IE doesn''t see it.



* CA Upsdel​​l *< cupsdel​​l0311XXX @ - @ - @XXXrogers.com>:
*C A Upsdell* <cupsdell0311XXX@-@-@XXXrogers.com>:

big {font-size:small; voice-family:" \"} \"" ;;
voice-family:inherit;字体大小:介质; }

big { font-size:small; voice-family: "\"}\"";
voice-family:inherit; font-size:medium; }




以一种令人讨厌的方式,这几乎是非常值得愚蠢的。


-

告诉我一个理智的人,我会治好他的。 - C.G.荣格



In a geeky way, that''s almost sig-worthy stupid.

--
"Show me a sane man and I will cure him." -- C.G. Jung


这篇关于CSS字体:检测字体DPI使用特定的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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