Make a Website (A Closer Look at CSS)


#1

Good day guys , i have an enquiry regarding Exercise 7 of Make a Website (A Closer Look at CSS).
I would appreciate your help alot.

Here is the link : https://www.codecademy.com/courses/make-a-website/lessons/closer-look-css/exercises/font-size?action=resume_content_item

em: A relative value that changes in proportion to the size of the parent element. For example, if a parent element has font-size: 20px;, child elements with 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.

Instructions
4.Now let’s resize anchor elements that are children of elements with the “hero” class using em values.
In main.css locate the .hero a selector. Change the font-size property to 1.25em;.
Click Run to see the anchor element’s size decrease.

image
image

Question: There hasn’t been any font size indicated for its parent element .hero , so how did em work on the selector .hero a?


#2

The em took effect because there is a default font size in HTML (16px), so 1.25*16px = 20px as you can check on .hero a element after right click -> Inspect.


#3

Good day there, thank you for enlightening me on my query.
On a side note, i’m pretty sure the default font size for HTML hasn’t actually been touched upon in any of the earlier CSS exercises? Just wondering if i had accidentally missed this out on my previous revisions .


#4

It hasn’t been modified by any previous exercise, since it is a default value.


#5

Sorry what i meant was has the default font size for HTML been mentioned anywhere in any of the previous CSS lessons?


#6

I can’t remember if it was mentioned, but anyway you already know what it is :smiley:


#7

This topic was automatically closed after 7 days. New replies are no longer allowed.