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

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

问题描述

在创建网页时,我们如何实现跨浏览器一致的字体大小.我在 CSS 中使用了类似 "font-size: 11pt; font-family: Helvetica,'Lucida Grande'" 之类的东西,但文本在 Firefox、IE、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.

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

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