响应应用程序:字体大小单位与px对pt对百分比 [英] Responsive App: which font-size units em vs. px vs. pt vs. percent

查看:123
本文介绍了响应应用程序:字体大小单位与px对pt对百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTML和CSS构建一个针对桌面,平板电脑和手机的响应式应用,但我不知道应该使用哪种单位字体大小,以适合任何大小的屏幕。 em,px,pt和百分比有什么区别?

I am building a responsive app targeted to desktop, tablet and mobile phone using HTML and CSS but I am not sure what unit font size should I use that the font fits well in any size screen. What's difference between em, px, pt and percent? What's the best choose for me?

我想在台式机,平板电脑和手机的响应式应用中听到真实的体验。

I would like to hear real experiences about it in responsive apps for desktop, tablets and mobile phones

我将非常感谢任何帮助!

I would be thankful for any help!

推荐答案

您可能想看看这篇文章: 小连结

You might want to take a look at this article: little link.

更新


  • px :像素是设备显示中的一个很小的方形(通常),一次只能显示一种颜色。您的屏幕分辨率指定了屏幕/显示的像素数。所以当你指定: font-size:12px; ,你基本上告诉浏览器每个字母应该是12像素高(大约 - 不同的字母高度变化a c:font-size:50%; c> 将元素的字体大小设置为其父元素的字体大小的50%。

  • pt 1pt (point)是1/72英寸。设置 font-size:12pt; 将字符的高度设置为12/72英寸(同样,不同的字符有所不同)。

  • em :em是所选字体中字母m的宽度,基本上与百分比相同,除了 1em code> 100%和 1.5em 150%。 >

So your choice would probably be px since it would preserve the logical proportions of text size to other sized elements.

所以你的选择可能是 px ,因为它会保留文本大小的逻辑比例

A note for the future: please try avoiding asking questions on StackOverflow when their answer can be found using a simple Google (or Bing, if you're a Microsoft-person) search.

这篇关于响应应用程序:字体大小单位与px对pt对百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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