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

karan Badhwar
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
karan Badhwar
Web Development Techdegree Graduate 18,135 Points

Shorthand

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; }

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

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.