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 Enhancing Design with CSS Styling Text Line-height and letter-spacing

karan karan
karan karan
Web Development Techdegree Student 4,139 Points


What if I use 100% for the Font-Size and in the next declaration I give 4rem for the heading so how does it work with line-height as I have given it 100% previously so when I change the value line-height will be measured on 4rem or 100% or it will be measured first on 100% and then it will change to 4rem for Reference before showing it on the Web?

h1, h2 { font: 400 100%/1.1 'Abolition Regular', Impact, Charcoal, sans-serif; } h1{ font-size: 4rem; } h2 { font-size: 2.5rem; }

Sergio Andrés Herrera Velásquez
Sergio Andrés Herrera Velásquez
Courses Plus Student 16,236 Points

Well, according to some rules set for css, the last value will apply to each element, so you will see it as 4rem and font-size 2.5 rem, and also rems and ems are dependendant of the context they are in, that is , either the container ( header, body, div) tags they are part of .

1 Answer

Alan Brown
Alan Brown
20,381 Points

Hi Karan, The line-height will be computed as 1.1 of whatever font-size the element is finally given. for your h1 that will be equivalent to 4.4rem, and for your h2 2.75rem.