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 Styling the Intro Paragraph

Jeremy Kerrigan
Jeremy Kerrigan
12,002 Points

Line height challenges, task 3 of 5

The challenge task asks:

Give the INTRO a unitless line-height value that is 1.6 times larger than the font-size property value. This is my code.

.intro { font-size: 1.25em; (this unit has already been determined correct) line-height: 2; ( the challenge deems my answer here incorrect) }

So my question is why am I incorrect with my solution. I believe the math is 1.25*1.6= 2

1 Answer

Ste Royle
Ste Royle
9,538 Points

When using a unitless value for line-height, which in this case is 1.6 what it is doing is taking the font-size and multiplying it by the unitless line-height which gives: 1.25em * 1.6 = 2em. You are right in thinking that the final calculated line-height is 2em but it wants you to add the 1.6 as the modifier.

.intro {
  font-size: 1.25em;
  line-height: 1.6;
}
Jeremy Kerrigan
Jeremy Kerrigan
12,002 Points

Wow thanks Ste. That absolutely worked. The question was a bit confusing. Really appreciate the help.