Which unit I should use in CSS when designing a web page

后端 未结 6 1569
臣服心动
臣服心动 2020-12-05 10:49

I have designed and developed more than 10 sites, but I still have a doubt about the correct unit I should use. Should it be px, em or %

6条回答
  •  孤城傲影
    2020-12-05 11:43

    If you're talking about font-size then px and pt are not ideal.

    Ems and Percent units are scalable, therefore they are far more accessible - friendly for the visually-impaired. They also scale down well for mobile phone users.

    Px and Pt units do not scale upward for visually-impaired users, or downward for mobile phones.

    If you're talking about layout or containers then it depends on the type of design you want - fluid or static - and there isn't necessarily a "right" answer.

    Without going into an example, it's difficult to advice. Do you have a site in mind we could look at?

提交回复
热议问题