跨浏览器的一致字体大小(网络开发) [英] Consistent font-size across browsers (web development)

查看:105
本文介绍了跨浏览器的一致字体大小(网络开发)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建网页时,我们如何在各种浏览器中实现一致的字体大小。我在我的CSS中使用类似font-size:11pt; font-family:Helvetica,'Lucida Grande',但是在Firefox, Google Chrome和Safari(这甚至不在不同的平台上)。基本上在同一台机器上,即运行Windows Vista,我在不同的浏览器下得到不同的外观和感觉。

When creating web pages how do we achieve a consistent font size across browsers. I have used something like "font-size: 11pt; font-family: Helvetica,'Lucida Grande'" in my CSS, but the text looks different in Firefox, IE, Google Chrome and Safari (and this is not even on different platforms). Basically on the same machine, that is running Windows Vista, I get a different look and feel under different browsers.

如何固定,以便文字的大小

How can this be fixed so that the size of text appears same on all the different browsers.

推荐答案

对于字体大小单位使用px(像素)而不是pt(点)。然后你将处理像素大小。

Use px (pixels) instead of pt (points) for your font size units. Then you'll be dealing with pixel sizes.

但请注意,这取决于您的网站的使用方式。在网站上由于硬编码字体大小导致的无障碍问题,已经出现了诉讼(在美国)。

Beware however, depending on how your site is used. There have been lawsuits (in the US) over accessibility issues on websites that result from "hard-coding" the font size.

这篇关于跨浏览器的一致字体大小(网络开发)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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