FAQ: Sizing Elements - Em

This community-built FAQ covers the “Em” exercise from the lesson “Sizing Elements”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn Responsive Design

FAQs on the exercise Em

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

so in what cases, we have to use px and when em? thanks

The example used in this task has left me quite confused. It states that the font-size of 1.5em is equal to 27 pixels, but surely it should be 24 pixels (16 * 1.5)?

Is there any details I am missing?

Thanks

KJ

1 Like

16 pixels is the default font size, but here font size is defined as 18 pixels. So the font size of h1 elements will be 18*1.5=27

2 Likes

Whoops, I missed the default 18px font size size.

Thank you!

1 Like

Hi question about em and rem units. If we are hard-coding the base font size and root element font size in px, wouldn’t the value of the em and rem units always be the same regardless of browser size because the values the relative too are hard coded? Wouldn’t this defeat the purpose of responsive design?

Hello! I’m working on the Bana’s Travel Blog exercise and for question #1, it asks us to set the font size to 1.5 em in #banner h1. Here is my code:

#banner h1 {

font-family: ‘Roboto’, sans-serif;
font-weight: 300;
font-size: 1.5em;
color: white;

}

The font size increases, but I still receive an error message: Did you sent the font size to 1.5em?

It seems to me that this is what I’ve done. I include a screenshot.

Thanks for any helpful commentary!
MP

I failed to get past the first question without getting the solution. Which looked the same as my answer-- which was rejected. Is this a bug?

https://www.codecademy.com/paths/learn-how-to-build-websites/tracks/responsive-design-and-accessibility/modules/learn-responsive-design-module/lessons/sizing-elements/exercises/em

Hiya, I also get the same message. I will try to report it as a bug. The solution looks much the same as mine. And the same problem occurs in the next exercise…

Same problem here I also reported that as a bug waiting for a fix or an answer.

This still has not been fixed.