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 Em Units

Antuan Vazquez
Antuan Vazquez
991 Points

Need help on the challenge asking to set the h2's 53px size to a relative em size.

So on the challenge it says to set the h2 font size of 53px to a relative em size. The h2 parent element is 16px. So I set it to 5.313 but the challenge says its wrong. What is incorrect about that??

This is how I wrote the code

/* Complete the challenge by writing CSS below */

header { font-size: 1.8em; }

.title { font-size: 1.625rem; }

h1 { font-size: 5.625rem; }

h2 { font-size: 5.313em; }

7 Answers

Hi Antuan,

You should be dividing the 53px by the 16px parent font-size.

I get 3.3125

Antuan Vazquez
Antuan Vazquez
991 Points

I used that value but it still marks it as a wrong answer. I guess its the challenge thats wrong not me. Thanks for the help anyways.

Did you specify it like this for task 2?

h2 {
  font-size: 3.3125em;
}

That passes task 2 for me. Maybe give it another try.

yeah i got 3.313 too and i even used the em converter he posted in the teachers notes to make double sure

Hi Michael,

In general, for these types of problems you should do the division on a calculator to get the most accurate results. You want to keep as many decimal places as possible. In this case, a calculator gives the exact answer of 3.3125 instead of the rounded off answer of 3.313 that any kind of program or website might give you.

Jaime McQueen
Jaime McQueen
2,885 Points

I have been having a similar issue as well, I am quite familiar with CSS coding and even double verified through several conversions and my Dreamweaver program, to arrive at 3.313em. There needs to be some clarification in terms of what rounding is expected as well as to specifically define exactly what is required within the question.

Antuan Vazquez
Antuan Vazquez
991 Points

Yeah I did. Must be a glitch.

Sorry it's not working out for you.

Maybe try doing a hard refresh on the code challenge page. Or clearing the browser cache.

If the problem persists then I would contact treehouse support.

hi, I had the same problem but Jason Anello's answer solved my problem I was dividing wrong but when I tried the solution had no boomer at the end.

thank you

Jason, i'm not going to apologize for using the resources provided in the teachers notes. If it is so wrong to use them then they should not be provided. i wasn't asking for help, i was stating that it happened to me too.

I apologize if it came across that way. That was not my intention. Nobody should be expecting you to apologize for that.

I was only trying to clear up any confusion that others may have who come across this same problem.

I will alert the staff to the problem.

thank you