如何计算类型的REM? [英] How to calculate REM for type?

查看:86
本文介绍了如何计算类型的REM?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将PX转换为REM类型?我读过Jonathan Snook的关于使用REM的文章,但他使用font-size:62.5%,默认为你的字体大小为10px(为了更容易计算)。

How do I convert PX into REM for my type? I've read Jonathan Snook's article about using REM, but he was using font-size:62.5%, which defaults to your font size to 10px (for easier calculating). How would I convert my PX units into REM if I was to use 100%, 75% and so forth?

推荐答案

<$。如果我使用100%,75% c $ c>目标大小/基本大小=值

因为我们可以假设浏览器使用16px作为默认(毕竟, Snook假设62.5%是10px),那么你的Base是16.如果你想要32px,那么 32/16 = 2 ,40px然后 40/16 = 2.5 ,想要24然后 24/16 = 1.5

Since we can assume that browsers use 16px as default (after all, that's what Jonathan Snook did to assume that 62.5% is 10px), then your Base is 16. If you want 32px, then 32 / 16 = 2, want 40px then 40 / 16 = 2.5, want 24 then 24 / 16 = 1.5.

同样75%...确定75%是什么(它是12),并执行相同的计算。如果你想要32px,那么 32/12 = 2.666 ,需要40px,然后 40/12 = 3.333 24/12 = 2

The same goes for 75%... Determine what 75% is (it's 12) and perform the same calculation. If you want 32px, then 32 / 12 = 2.666, want 40px then 40 / 12 = 3.333, want 24 then 24 / 12 = 2.

这篇关于如何计算类型的REM?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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