Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

To what decimal place?

What is the popular or recommended industry practice?

1 decimal place? ----> 83.7 2 decimal places? ---> 83.67 3 decimal places? ---> 83.667 more? ------------------> 83.666666667

3 Answers

Richard Rakin - Well let's see how the math works out, take for example 14px as your target and 1980px as your context.

(14 / 1980) * 100 = 0.7070707070707071%, round that to 0.708%

Let's check our math and convert that back to pixels (0.708 / 100) * 1980 = 14.0184px

Since most browsers don't support fractional pixels, rounding to 3 decimals places, should do the trick.

I would try to be as specific as possible to get the exact measurement that you need.

For CSS? Rounding to the nearest tenth of a percentage is what is recommended in the Treehouse course.