px,em和ex之间有什么区别? [英] What is the difference between px, em and ex?

查看:581
本文介绍了px,em和ex之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

px em ex ?当您在CSS中定义font-size时,是否使用 px pt em

What is the difference between px, em and ex? And when you define font-size in CSS, do you use px, pt or em?

推荐答案


  1. 像素( px )是依赖于浏览器的。这是您在屏幕上看到的绝对大小。

  2. Em 类似于百分比。 Em s是指基本文本大小。 1 em 的值表示与 100%的值相同的值。但您也可以用相反的方式说:百分比值只是 em 乘以100。

  3. 点数c $ c> pt )是您要在平面媒体中使用的内容。

  1. Pixels (px) are browser dependent. It is the absolute size that you would see on your screen.
  2. Em are sort of like percentages. Ems is referring to the base text size. The value of 1 em means the same thing as a value of 100 percent. But you can also say it in the opposite way: A percentage value is just an em multiplied by 100.
  3. Points(pt) are what you would want to use in print media.

这篇关于px,em和ex之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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