css divide width 100% to 3 column

前端 未结 11 636
余生分开走
余生分开走 2020-12-12 21:38

I have a layout where I have 3 columns.

Therefore, I divide 100% by 3.

The result is obviously 33.333....

My goal is perfect

11条回答
  •  情书的邮戳
    2020-12-12 22:35

    I have found that 6 decimal places is sometimes required (at least in Chrome) for the 1/3 to return a perfect result.

    E.g., 1140px / 3 = 380px

    If you had 3 elements within the 1140 container, they would need to have a width set to 33.333333% before Chrome's inspector tool shows that they are at 380px. Any less amount of decimal places, and Chrome returns a lesser width of 379.XXXpx

提交回复
热议问题