Are the decimal places in a CSS width respected?

前端 未结 6 721
别那么骄傲
别那么骄傲 2020-11-22 04:35

Something I\'ve been wondering for a while whilst doing CSS design.

Are decimal places in CSS widths respected? Or are they rounded?

.percentage {
           


        
6条回答
  •  梦如初夏
    2020-11-22 04:44

    They seem to round up the values to the closest integer; but Iam seeing inconsistency in chrome,safari and firefox.

    For e.g if 33.3% converts to 420.945px

    chrome and firexfox show it as 421px. while safari shows its as 420px.

    This seems like chrome and firefox follow the floor and ceil logic while safari doesn't. This page seems to discuss the same problem

    http://ejohn.org/blog/sub-pixel-problems-in-css/

提交回复
热议问题