Rem单位仅对字体大小有用吗? [英] Are rem units only useful for font-size?

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

问题描述

我将rems用于所有类型的元素,例如:

I'm using rems for all kind of elements such as:

html: 62.5%;

.element {
   font-size: 1.6rem;
   margin: 2rem 0 1rem 0;
   padding: 1rem;
   min-height: 3rem;
   height: 100%;
}

我已经阅读了一些文章,了解使用REM的优势而不是PX.我目前总体上使用REM,但是我已经开始考虑它是否仅对字体大小有用.

I've read some articles regarding the advantages of using REM and not PX. I'm currently using REM overall but I've began to think about if its only useful for font-size or not.

那么,REM在其他元素中有用还是在所有元素中使用都有些过头?

So, is REM useful in another elements or using them in all the elements is a bit overdone?

推荐答案

赞成在整个布局中使用rem或em单位的一个巨大论据是,整个布局将随文本缩放.这对于使用较旧的浏览器的可访问性很重要,较旧的浏览器提供了增加字体大小的选项,而不是大多数浏览器现在提供的缩放"功能.为了使网页更易于阅读,可见度较低的人们经常增加字体大小-在使用rem或em单位表示页面上所有元素的网站中,整个页面都会缩放.此参数现在 less 无关紧要,但对于旧版浏览器支持仍然很重要(IE6在许多学校和办公室中仍在使用!).

A huge argument in favor of using rem or em units for your entire layout is that your entire layout will then scale with the text. This was important for accessibility with older browsers, which offered an option to increase the font size rather than the "zoom" feature that most browsers offer now. In order to make webpages more easily readable, persons with low visibility often increased the font size -- and in websites which use rem or em units for all elements on the page, the entire page would scale. This argument is less relevant now, but still important for legacy browser support (IE6 is still used in many schools and offices!).

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

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