The tags used for text are primarily two: one for titles and one for paragraphs. For titles, the h tag is used, followed by a number from 1 to 6 that determines the font size and thus the title’s emphasis. Here’s an example of using the H tag:
This is my first text
By assigning the value 1 to the h tag, we’ve given our text importance, transforming it into a title. As mentioned, there are 6 possible values for the h tag, ranging from 1 to 6:
….
….
….
….
….
….
Clearly, the number 1 corresponds to the largest size, and 6 to the smallest. Try writing the following example and load the page in your browser to see the font size differences:
This font is H1
This font is H2
This font is H3
This font is H4
This font is H5
This font is H6
Here’s the result you’ll get:
This font is H1
This font is H2
This font is H3
This font is H4
This font is H5
This font is H6
Having analyzed the tag for determining title sizes, let's now look at the tag that determines the size of paragraphs and everything else that isn't a title. This size is expressed in pixels, abbreviated as px, which is essentially the parameter specifying the font size. This parameter is completed with the numerical value assigned to the font itself. Thus, we'll have 1px, 2px, 3px, and so on, using the font size tag specifically for this purpose. Let's see how to express size in pixels in HTML:
font size="7px">This is my first text
A bit of flexibility is helpful, so we can also omit the 'px' attribute, and the result will be the same. As you've seen, the h tag, used for titles, works on its own, enclosing the text without additional commands. The font size tag, however, is part of the command that controls the font and must be included within the font face tag.
Pubblicato in HTML & CSS
Be the first to comment