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 Build a Responsive Website Introduction to Responsive Web Design Converting Nested PX to EMs

Code Challenge : Convert px in em

I don't understand where is my mistake.

The question challenge is : Now, using an H2 with a font size of 18px as your context, convert the size of the link inside the H2 from 14px to ems.

    <p><!DOCTYPE html>
<html>
<head>
  <style>
    body { font-size: 16px; }
    h1   { font-size: 24px; }
    h1 a { font-size: 0.75em; }
    h2   { font-size: 0.75em; }
    h2 a { font-size: 0.77em; }
    p    { font-size: 12px; }
    p a  { font-size: 10px; }
  </style>
</head>
<body>
  <h1><a href="#">Smells Like Bakin</a></h1>
  <h2><a href="#">Sizzling</a> in the Oven</h2>
  <p>Opposites really do attract, especially in
  <a href="#">our kitchen</a>! We combine unexpected
  flavors that melt together to create ironically
  delicious desserts.</p>
</body>
</html>
</p>
    ``` 
I also tried with 0.7777778em.

Could you gibe me the solution and explain to me my mistake please.

4 Answers

Wayne Priestley
Wayne Priestley
19,567 Points

Hi Cyril, Your conversion is correct, but take a look at the top of your code to the left of DOCTYPE, and again at the end after html. You have p tags, this could be causing you challenge to fail.

Thanks Wayne !

Anika Jaffara
Anika Jaffara
20,364 Points

Wow... any thoughts on what's up with mine?

<!DOCTYPE html> <html> <head> <style> body { font-size: 16px; } h1 { font-size: 24px; } h1 a { font-size: 0.75em; } h2 { font-size: 0.75em; } h2 a { font-size: 0.77em; } p { font-size: 12px; } p a { font-size: 10px; } </style> </head> <body> <h1><a href="#">Smells Like Bakin</a></h1> <h2><a href="#">Sizzling</a> in the Oven</h2> <p>Opposites really do attract, especially in <a href="#">our kitchen</a>! We combine unexpected flavors that melt together to create ironically delicious desserts.</p> </body> </html>

Wayne Priestley
Wayne Priestley
19,567 Points

Hi Anika,

Could you make a new post with your question please as more people will see it and offer advice.
If you include your html and css too that would be great.

Here is a link to explain how to use Markdown to post your code How to post code

If you look at the bottom of the box when your typing a reply you will see Markdown Cheatsheet that will also explain how to post your code.

Hope this helps.