Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS width percentage accuracy

Tags:

html

css

Would width: 33.3% or width: 33.3333333% be less wide (accurate) than width: calc(100% / 3); (would equal to 33.33∞ <- infinite). In Math it does, but CSS..?

like image 739
Kevin Avatar asked Oct 24 '25 23:10

Kevin


1 Answers

In my experience, the calc is more accurate. If I have 3 columns filling the entire viewport with equal width, the calc(100vw / 3) always work in all browser, but 33.3333vw sometimes leaves a single pixel line in between.

You might find more info here: https://trac.webkit.org/wiki/LayoutUnit

like image 181
VorganHaze Avatar answered Oct 27 '25 14:10

VorganHaze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!