IE7-8的Rem后备广告 [英] Rem fallback for ie7-8

查看:45
本文介绍了IE7-8的Rem后备广告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为所有现代"网站使用"rem"单元,以使其与ie7-8兼容.我正在使用输出"font-size:10px; font-size:1rem;"的较小函数".font-size(10);",因为我在实际中使用rem没有像素后退,我的CSS的所有内容(宽度,顶部,字母间距等)都将更加精简. .htc文件自动将rem格式化为px会有多困难?没有js还有其他方法吗?

I'm using the "rem" unit for all my "modern" websites, to make this compatible with ie7-8 I'm using a less function ".font-size(10);" that outputs "font-size:10px; font-size:1rem;" As I am using rem for practical everything (width, top, letter-spacing,...) my css would be much leaner without the pixel fallback. How difficult would it be making a .htc file that automatically formats rem into px? Are there other ways without js?

推荐答案

如果您需要支持IE7/8,只需坚持使用LESS后备功能.

If you need to support IE7/8, just stick with the LESS fallback function.

要摆脱像素后备以节省字节数,这根本不值得.

It's simply not worth trying to get rid of the pixel fallback to save bytes.

夸张地说,您的CSS中有100个font-size: 10px;实例.这是100 * 16字节,仅为〜1.6KB.而且它甚至比HTTP压缩后还要少.可以忽略不计.

Let's exaggerate and say you have 100 instances of font-size: 10px; in your CSS. That's 100*16 bytes, which is just ~1.6KB. And it will be even less than that after HTTP compression. It's negligible.

您可能还有更多重要的事情要担心.

You probably have more important things to worry about.

这篇关于IE7-8的Rem后备广告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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