As you can see, the <h1>test</h1> <h2>There is no name</h2> which was nested inside another <h1> tag are larger in size than the <h1>Hello, React!</h1>{" "} <h1> Hello {isNameShowing ? name : "someone else"}</h1> where <h1> isn’t nested inside another <h1>
Agree with the above replies. Also, I think your test simply reveals that those tags are relative and not absolute. They increase the font by an amount, not set it to a specific value.
I combined both into one image since FreeCodeCamp won’t allow me to upload two separate images as my account is new
I know putting an <h1> or <h2> inside another <h1> isn’t semantically correct. But my question is in this case when done so, why the nested (inside another <h1>) <h1> and <h2> are larger than the usual <h1> and <h2>
I know this was marked as solved and hopefully the answer makes sense. But I have a bit of an objection to how w3schools is wording this. I’m not sure “current font size” really explains it.
If we look at MDN instead it is better explained as relative to the parent font size.
Font size of the parent, in the case of typographical properties like
font-size, and font size of the element itself, in the case of other properties
like width.