HTML [Hyper Text Markup Language]

Learn HTML

Fonts - Size, Style & Attributes

To customize the font style we have to use the tag <font> Fonts come in 7 sizes: Increasing size from 1 to 7.

<body>
Simple Example of using <font>Font tag</font>
</body>

Then specify a size attribute in the font tag like below.

<body>
If u need to give the font size 6 means u have to add size attribute in the font tag like <font size="6">This Font Size is 6</font>
</body

Normal function of tags and attribute is, A <tag> tells the browser to do something. An attribute goes inside the <tag> and tells the browser how to do it.
Second point is about defaults. As you probably know, the default value is a value that the browser assumes if you have not mentioned any value inside the tag. A good example is the font size. The default font size is 3.

Every browser has a default font setting for font name, size and color. Unless you have input some value with it the default is probably Times New Roman or Verdana 12pt (which translates into 3 for our purposes) and it's black. Of course we can specify font names other than the defaults. Like Arial and Comic Sans MS.

<body>
This font face is <font face="arial">Arial</font>
</body>

The font will only display if your visitor has that font installed on their computer. Let me repeat... If the person looking at the page doesn't have installed on their computer the font you specify, then they will only see the default font. So be very judicious in using fonts. Arial and Comic Sans MS are pretty widely distributed with Windows, So is Impact.

Common fonts that are on *most* computers and are pretty safe.

Arial
Arial Black
Arial Narrow
Bookman Old Style
Century Gothic
Comic Sans MS
Courier New
Georgia
Impact
Lucida Console
Tahoma
Times New Roman
Verdana

HTML is largely case INsensitive. You could just as well use <FONT> instead of <font>. However, for a couple reasons, one being it's easier, it's not a bad idea to keep everything lower case, so better use lowercase for all tags.

Changing Font Color

<body>
This font color is <font color="#ff0000">Red</font>
</body>

We can, of course use more than one attribute in a <font> tag...

<body>
This font has two attributes with <font color="#ff0000" face="arial" size="4">Size of 4 and color is </font> Red !
</body>

Just a recap of nesting multiple tags
<tag3><tag2><tag1>Hi guys !</tag1></tag2></tag3>

Line Break

<body>
Now we will study how the browser takes over the formatting. Even though you entered the text in next line browser doesnt seems it so it will take this line in same line
</body>

The browser doesn't recognize formatting. Unless you tell it otherwise, it just displays the characters in a steady stream. If you want to start a new line you have to use a line break that is <br> tags in the code to perform the text in next line. Check the eg., below.

<body>
This text
<br>will be in
<br>separate line as
<br>next line
</body>

Tag <br> basically commands the browser to display in the next line - that it says to start in a new line.