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 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.

TIA!