Rem fallback for ie7-8

蓝咒 提交于 2019-12-02 11:31:21

问题


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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/18333129/rem-fallback-for-ie7-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!