CSS - Percentages or Pixels?

前端 未结 9 760
梦如初夏
梦如初夏 2020-12-04 21:54

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 pixel

9条回答
  •  遥遥无期
    2020-12-04 22:41

    Reasons aplenty! Percentage widths are very useful when it comes to sizing elements relative to something else (browser size for instance). You can have your page dynamically change to fit different circumstances. Pixels on the other hand are useful when you need precision sizes that won't change on you. Some people (e.g. me) use both pixels and percents to position elements how you want them. Others (e.g. people other than me :P) will tell you this is stupid.

提交回复
热议问题