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.
Peter Huang3,590 Points
I understand the difference between Em and Rem for CSS, but Rem seems easier than getting confused by Em and changing al
I understand the difference between Em and Rem for CSS, but Rem seems easier than getting confused by Em and changing all over and getting confused..
What is the advantage of using Em and stress with the calculation? Is it because different screen have different font size and Em will be able to show layout exactly in all font size and calculate it? I dont get why people stress using em..
Steven Parker218,596 Points
The value of em is that it is relative to the font size of the parent element. So if you want an element to differ from it's parent by a certain percentage increase (or decrease) in font size, using em allows that relative change to be preserved if future changes are made to the parent element.
On the other hand, rem keeps the target element font size the same if and when a change is made to the parent element. So it's basically a design decision — are you choosing a specific size for the element based only on the root document font size, or are you creating a percentage change relative to the parent element?