218k views
4 votes
Consider the following code where the font-size of a div is 32px, the font-size of a paragraph is .5em, and the font size of a span element is .5em.

Here, there.. How big is the font

?

User Eugene Yu
by
8.0k points

1 Answer

5 votes

Final answer:

The font size of a span element inside a paragraph set to .5em, within a div of 32px, is 8px.

Step-by-step explanation:

The font size of a element inside a paragraph () which is set to .5em will be calculated based on the font size of the paragraph itself. Given that the paragraph is .5em and it's within a

with a font-size of 32px, the actual font size of the paragraph is half of 32px, which equals 16px. As the

has a font-size of .5em, this will again be in relation to the paragraph; hence the font size of the element would also be half of the paragraph's font size, resulting in an 8px font.

User Foobrew
by
8.2k points