CSS - 百分比或像素? [英] CSS - Percentages or Pixels?
问题描述
我已经使用CSS多年了,我一直是一个百分比的家伙,因为我总是定义高度和宽度使用百分比而不是像素(除了,例如,当设置的东西作为边距,填充等,在这种情况下我使用像素)。
I have been using CSS for many years now, and I have always been a 'percentage' kind of guy, as in I always define heights and widths using percentages as opposed to pixels (except, for example, when setting things such as margins, padding, etc, in which case I use pixels).
我会这样做:
body{
height: 99%;
width: 99%;
margin-top: 10px;
}
但我经常看到这样的例子:
but I often see examples such as this:
body{
height: 300px;
width: 250px;
margin-top: 10px;
}
我的问题是这样的:
谢谢。
推荐答案
移动网页。 %的岩石。因为它会(显然)适应。
Mobile webpages. %'s rock for that. As it will (obviously) adjust to suit.
但是,如果你想要一个固定宽度的例子,你希望以某种方式显示一篇文章,px是胜利者。
However when you want a fixed width for say example an article of text that you want displayed in a certain way, px's is the winner.
两者都有许多加号和减号彼此:)
Both have many plus's and minus's over each other :)
这篇关于CSS - 百分比或像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!