If you have an element with the font size of 24px, and a child element inside with a font-size set to .5em, what is the font size of the child in px?

Enhance your coding skills with our Web Development 201 Quiz. Practice with multiple-choice questions and find detailed explanations for each question. Ace your web development exam!

To determine the font size of the child element set to .5em, it’s essential to understand how the CSS unit "em" works. The em unit is relative to the font size of its parent element. In this case, the child element has a font size of .5em, which means it will be half of the font size of its parent.

The parent element's font size is given as 24px. When calculating the child's font size, you multiply the parent's font size by the specified em value:

.5em * 24px = 12px.

Thus, the font size of the child element will be 12 pixels, confirming that the correct answer is indeed 12px.

The other choices do not align with this calculation. For instance, 0.12px and 1.2px would imply a much smaller size than the reduction from the parent size, while 120px represents an inflated size that exceeds the parent's size, which is not how em units function.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy