哪个更好地使用CSS,百分比或像素? [英] Which is better to use in CSS, percentage or pixels?
问题描述
我不是一个CSS专家,我想做一个设计,将看起来不错的所有浏览器和分辨率。我注意到一些网站做了他们的设计( width
, height
, margin
, padding
)与百分比,而不是像素,我正在做所有我的设计与百分比。这种方法有什么问题吗?
I am not a CSS expert and I want to make a design that will look good in all browsers and resolutions. I noticed that some websites make their design (width
, height
, margin
, padding
) with percentage, not pixels, and I am doing all my design with percentage too. Does this approach have any problems?
请告诉我。
推荐答案
使用这种方法不会有任何问题,百分比和像素工作正常取决于您的需要。如果你需要一个流动的网站,那么百分比可能是你最好的选择。
You won't have any problems using this approach, both percentage and pixels work fine depending on your needs. If you need a fluid site, then percentage might be your best option. And ems for the fonts, so the user can modify its display if necessary.
几个专家对此的意见:
http://kyleschaeffer.com/best-practices / css-font-size-em-vs-px-vs-pt-vs
http://webdesign.about.com/cs/typemeasurements/a/aa042803a.htm
这里有一个有趣的转折:百分比+像素:
And here's an interesting twist: Percentage + pixels:
http://www.cssplay.co.uk/boxes/outside.html
这篇关于哪个更好地使用CSS,百分比或像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!