0

[SOLVED] Font VS Heading in html

Why <font size=7><h1>BIG</h1></font> shows much bigger characters than <h1><font size=7></font></h1> ?

30th Oct 2020, 12:58 PM
#f9CSERS™
#f9CSERS™ - avatar
2 Réponses
+ 3
h1 uses a font-size of 2em by default. em is relative to the font-size of the element (2em means 2 times the size of the current font). Since the font size="7" outside of the h1 would increase the font-size of the h1, the 2em multiplies that increase by 2. That makes it huge. The h1 outside of the font leads to a smaller font because the text directly in the font element uses the font size you indicated, "7". On a side note, the font tag should generally be avoided. span or more meaningful/semantic tags like p with CSS is the more modern and SEO way to style fonts for text.
31st Oct 2020, 7:32 AM
Josh Greig
Josh Greig - avatar
0
Thanks! And about using CSS, I'll shift to that once I finish these tags (even if they are obsolete in html5). Thanks bro once again.
31st Oct 2020, 7:34 AM
#f9CSERS™
#f9CSERS™ - avatar