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

Joseph Burdick
Joseph Burdick
11,543 Points

I think Treehouse is wonderfully responsive but can you explain why you guys use px for sizing instead of rem?

I remember taking a course here where rem was discussed and it seemed like the superior choice in units but then I got curious and peeked under the hood.

Pixels.

Whaddupwiddat? ;)

2 Answers

Lorenzo Pieri
Lorenzo Pieri
19,772 Points

I cannot answer with certainty, but the possible explanation is this:

Sometimes you want to use fixed px measurements to secure that everything works perfectly as imagined but MORE THAN THAT we also might remember that the REM measurement is not 100% supported by older browsers, that is probably why they did not use it. Consider a possible person with IE8. He probably won't be able to recognize rems attributes. Also rems are useful when you want to style with EMs aswell.

Please, check this chart of "CAN I USE" below, to check out why:

Browser compatibilty of REM

Have the best day!

If I remember correctly root em is introduce in CSS3 which solves by defining a single font size on the html element where it defines all rem units to a percentage in relative of the parent. Using rem is great design strategy, good for diverse users, and adjusting to diverse monitor display (like Mac Retinas). I do believe applying web accessibility is very important and having a responsive design. Moving on, so why use px?

The only answer I can think off. There are still users out there are using ol' school computer and browser. Like really outdated browser where rem has no support in those browsers. So using px will work on older browser and accommodate those users.

On the other side, personally I am more comfortable using px, when coding and designing. Because I can see visually with a good idea of size. I like the consistency of px and can use it to size element precisely, so precise to a single pixel :D. I am sure that there are many feature in mainstream browser that can still zoom into px define element and fix the issue to a degree. But, staying up to date and following best practices for usability and accessibility is best for good reasons :).