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 and Rem Units

Gerald Susanteo
seal-mask
.a{fill-rule:evenodd;}techdegree
Gerald Susanteo
Front End Web Development Techdegree Student 7,117 Points

Create a new rule that targets the h2. The parent element of the h2 has a font-size value of 16px. Use an em unit to giv

my first answer was 3.313em and it says i was wrong so search for the answer from the community 3.13125, and still wrong

2 Answers

Perfect. That’s why 3.3125em is correct.

I have looked at the challenge as well, and it’s the other way around (em*16 = ... px)

header { font-size: 1.8em; (28.8px) }

.title { font-size: 1.625em; (26px) }

h1 { font-size: 5.6(89.6px)

Hi Gerald,

What is the target font size in your question? In a general sense, you can convert px to ems by dividing the target font size by the parent element font size. e.g. target font-size: 80 px - parent element: 16px = 80/16 = 5em

Assuming the target font size is 50px, divide it by 16 = 3.125em.

for 53px/16 = 3.3125em

Hope that helps.

Regards, H