CSS - Percentages or Pixels?

前端 未结 9 758
梦如初夏
梦如初夏 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:50

    I use pixels on my website and I keep a maximum width of 1000px. My website displays properly on my 11" netbook, however does not do very well with mobile devices, but that is what this is for:

    
    

    I find developing websites in percentages very time intensive, having to consider all re-sizing events, such as:

    overflow:scroll;
    

    Pixels and percentages both have their perks, but I would say that pixels would be a better choice because of precision, reliability, and is easier to develop. Also another thing to consider are pixels and percentages for fonts. Here is my rule of thumb:

    • If you are developing a website with percentages, use percentages for the font, for the reasons of keeping proportions correct.
    • If you are developing a website with pixels, use pixels for the font.

    If you have people that may need to enlarge the font it is always better to use percentages for the font.

提交回复
热议问题