有没有真正的任何点在CSS中使用相对字体大小? [英] Is there really any point to using relative font sizing in CSS?

查看:263
本文介绍了有没有真正的任何点在CSS中使用相对字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多关于使用相对或绝对字体大小调整大小的优点和缺点。固定大小不放大IE6,但这不是很多的问题,这些天。可访问性很重要,但我认为所有良好的无障碍软件都是为了处理这些问题而创建的?

I've read a lot about the pros and cons of sizing with either relative or absolute font sizes. Fixed sizes don't zoom in IE6 but that's not much of an issue these days. Accessibility is important, but I assume that all good accessibility software is built to deal with these issues?

我想这主要归结于你是否想要改变所有字体大小与一个规则(即您设置的默认字体大小),还是你想要能够改变字体大小而不影响嵌套元素(这是最让我失望的东西!)。

I guess it mainly comes down to whether you want to be able to change all font sizes with one rule (i.e. the default font size you set) or whether you want to be able to change a font size somewhere without affecting nested elements (this is the thing that frustrates me most!).

任何人都有任何提示?

推荐答案

根据 YUI Font CSS


始终使用百分比作为单位
,因为它们比ems更一致地提供
,并且因为它们允许
用户启动的调整大小(与
像素不同)。

Always use percentages as the units because they render more consistently than ems, and because they allow user-initiated resizing (unlike pixels).

当它们是像YUI这样的框架的一部分时,相对字体大小工作得很好。特别是因为它们规范了字体在浏览器上的工作方式。

Relative font sizes work pretty well when they are part of a framework like YUI. Especially because they normalize how fonts work across browsers.

我个人来说,我每隔一段时间就会抛出绝对px,但是通常只有文本,与一些其他设计元素(如菜单)。

Personally, I do throw in absolute px every once in a while, but typically only for text that must somehow match up size-wise with some other design elements (like a menu).

当您将%分配给某个元素,然后将%分配给包含的元素时,%stuff会分解。但这是我发现的唯一真正的东西。

The % stuff does break down when you assign % to a certain element and then a different % to a contained element. But that's the only real gotcha I've found.

这篇关于有没有真正的任何点在CSS中使用相对字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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