How many decimal places does the CSS browser support or recognize?

-1

I've seen more and more values with multiple decimal places in CSS styles. Then came the doubt. How many decimal places does CSS actually accept and can the browser render?

How well do these values work?

width: 8.33333333%; (Grid do Bootstrap por exemplo)

or

font-size: 1.062575rem; (conversões de PX em REM)

Are these decimal places really interpreted precisely by the Browser, or does it as well as CSS have a decimal place limit?

    
asked by anonymous 10.03.2018 / 19:57

2 answers

2

Each browser works in a different way with floating points. To ensure that it works correctly, you can work with fractions and calc.

For example:

width: calc(100% / 3);

Source: link

    
10.03.2018 / 20:00
0

It seems like neither CSS nor HTML has a decimal place limitation. This calculation will be by Browser, and according to this table to see clearly that modern browsers work much better with those decimal places and more complex calculations.

Internet Explorer 7 truncate to 2 decimal places
Internet Explorer 8 truncate to 2 decimal places
Internet Explorer 9 truncate to 2 decimal places
Internet Explorer 10    truncate to 2 decimal places
Internet Explorer 11    truncate to 2 decimal places
Firefox 3.0 truncate to 3 decimal places
Firefox 3.5 truncate to 3 decimal places
Firefox 31  truncate to 3 decimal places
Chrome 20   round to 15 decimal places
Chrome 21   round to 15 decimal places
Chrome 37   round to 13 decimal places
Safari 6 (OSX Lion) round to 15 decimal places
Safari 6.1 (OSX Mountain Lion)  round to 15 decimal places
Safari 7 (OSX Mavericks)    round to 15 decimal places
Mobile Safari 7 (iOS7)  round to 15 decimal places
Mobile Safari 8 (iOS8)  round to 15 decimal places
Chrome 36 (Jelly Bean) [Nexus5] round to 15 decimal places
Chrome 30 (KitKat) [S5] round to 15 decimal places
Android Browser 4 (Jelly Bean) [Nexus7,Nexus4,S4,S3]    round to 15 decimal places
Android Browser 4 (Ice Cream Sandwich) [Nexus,KindleFire2]  round to 15 decimal places
Android Browser 4 (Gingerbread) [S2]    truncate to 3 decimal places
Opera 12    truncate to 2 decimal places
Opera Next 24   round to 13 decimal places

Source: link

For those who are curious and want to test the browser to see how many houses it recognizes here has a test page. link

    
13.03.2018 / 00:18