Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Basics (2014) Understanding Values and Units Rem Units

Dennis Brown
Dennis Brown
28,742 Points

Is Rem's ability to ignore compound Em's just an overlay for the parent element?

So I was looking at what was happening in Dev Tools, and played around with some of the CSS elements to see and make changes on the fly. I of course noticed that the rem was disabling the Em, great!

I also noticed that when I manually disabled the main-header em, a space above the span element text (.title), disappeared. If I was to increase the em size, that space became larger as if it was there "just in case" to cater to the em text size. Removing or reducing the main-header em value to 1em removed this "padding" of sorts as well.

So is rem simply overlaying the space, and the line space needed for the em is there to cater to it if it is needed? If so, what is the common practice to make sure that you do not add too much padding, or none at all from rem replacements?

This is really easy to see when setting main-header to 3 or 4em, but after that it becomes quite obvious with anything above 1em.