使用字体大小的百分比? [英] Using percent for font size?

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

问题描述

我最近看过关于调整字体大小,大部分它嘲笑使用px作为不可原谅的犯罪(确定,也许不是那么糟糕,你得到的想法),因为它不能在旧版浏览器正确调整。 / p>

我真的想要一个我自己使用的标准,在过去是px,只是因为它很简单,容易理解,并且很容易实现确切的字体在设计中指定的尺寸 - 但我现在怀疑使用px。



我最近使用em,因为它需要使用jQuery的文本调整功能。但是我发现它很令人沮丧,因为如果你有两个元素内部的两个元素与指定的em大小(希望有意义)的方式放大。



我想知道使用%字体调整大小,我看到一些大的网站使用这种技术(即雅虎),从我的理解,似乎有所有的优点,没有令人难以置信的烦恼放大事情。 / p>

简而言之,我只是想知道在CSS中使用%字体调整是否有任何问题?在字体调整方面比使用PX更好吗?



如果在问题之前的问题有点多,请不要抱歉:/我还是习惯了整个QA事情

解决方案

在CSS3中,使用 rem c $ c> em )。尺寸不会受父元素大小的影响。


I've read a fair bit about resizing fonts recently, most of it deriding using px as an unforgivable crime (ok, maybe not that bad, you get the idea) because it doesn't resize properly in older browsers.

I really want to have a standard that I use myself, in the past that has been px, simply because it's simple, easy to understand and fairly easy to achieve the exact font sizes that are specified in designs - but I'm now doubting using px.

I used em on a project recently because it needed text-resizing functionality which I made using jQuery. But I found it quite frustrating because of the way that em amplifies if you have two elements inside of each other both with an em size specified (hope that makes sense)

So I was wondering about using % for font resizing, I've seen a couple of big websites use this technique (namely, Yahoo) and from what I understand it seems to have all of the advantages of em without the incredibly annoying amplification thing.

So in short, I'm just wondering if there are any issues with using % for font-sizing in CSS? Would it be better than using PX in terms of font-resizing? And are there any noticeable draw backs?

Apologies if the blurb before the question is a little much :/ I'm still kind of getting used to the whole QA thing

解决方案

In CSS3, use rem (root em). Sizing will not be affected by em size of the parent element.

这篇关于使用字体大小的百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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