FAQ: A Closer Look at CSS - font-size

This community-built FAQ covers the “font-size” exercise from the lesson “A Closer Look at CSS”.

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

Make a Website

FAQs on the exercise font-size

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!

Is the parent element of the anchor div? If em is relative, why isn’t anchor bigger than its parent if its font is 1.25.

1 Like

There seems to be a typo in this exercise: It says that when you change it to 1.25em the size should decrease, but shouldn’t it increase?

On the page “Making A Website: font-size (7/10), Instruction 3”, when asked to change the p selector’s font size to 2rem in main.css and doing this successfully, I receive an error message: “Incorrect: Did you add a font-size of 2rem for the p selector in main.css?” This must be a bug because I cannot for the life of me detect any error in my CSS whatsoever. I even copy and pasted the exact text in the instruction box and it’s still apparently wrong.

I cannot even select “View solution” as that gets stuck in a loading loop. Restarting my browser (Firefox 90.0.1) did nothing, nor did clearing the Codecademy’s cookies.

Here is a copy of my exact CSS. Note that all I’ve changed is font-size in h2 (as per instructions 1 and 2) and font-size in p (as per instruction 3):

body {
height: 100%;
margin: 0;
text-align: center;
width: 100%;
}

h1 {
font-size: 32px;
font-family: Palatino, ‘Palatino Linotype’, serif;
color: rgb(121,149,117);
}

h2 {
font-size: 56px;
}

.hero {
padding: 250px 0;
margin: 30px;
font-family: ‘Trebuchet MS’, Helvetica, sans-serif;
}

p {
font-size: 2rem;
}

.hero a {
color: #00FFAA;
font-size: 1.25em;
text-decoration: none;
}

1 Like

It is the extract from CSS font size
1em; would be equivalent to 20px . Child elements with font-size: 0.5em; would be equivalent to 10px (a halving) and so on.
Based on the website information:
1em = 16px
0.5em=8px

It is the table extracted from the web-site
EM to PX Conversion Table

EM PX
0.25em 4px
0.5em 8px
0.75em 12px
1em 16px

Is there any error in the context of your tutorial pertaining to the CSS em font size?

It is the link of your tutorial.
https://www.codecademy.com/courses/make-a-website/lessons/closer-look-css/exercises/font-size