Tap to Read ➤

HTML Codes For Websites

Omkar Phatak
Hypertext markup language (HTML) must be mastered, to design simple web pages. Read to understand how the various tags of the language work, to create a web page.
HTML can be interpreted by a browser and it renders a web page, according to the code written in it. It is a markup language where you prompt a browser about how you expect the web page to look. It is a language with a WYSIWYG philosophy.

Introduction to Tags

The HTML code is the language which the web browser reads. It is inevitable that you know the code and tags, to create a web page. There are certain rules that you need to follow, in order to write the correct codes for any website.
Every web page is created from a 'source code' file. To create a basic web page, all you need is a text editor like notepad. You write the contents of the web pages in this text file, along with all the HTML markup codes distributed inside.
This file is saved with a '.html' or '.htm' extension. When a browser like 'Firefox' or 'Internet Explorer' opens this file, it is rendered as a web page.
Every 'tag' is written within a pair of opening (<>) and closing angular brackets (</>). In between these two bracket pairs, lies the text to be formatted or given a specialized form.
A browser is not case-sensitive to tag text, within angular brackets. Every tag may have certain attributes, which are placed within the opening angular brackets (<>), after the tag name.
The whole source code of a web page is enclosed within <html> and </html> tags. The browser reads the code and content written after <html> tag.
The content of a web page displayed by the browser, is contained in the <body> and </body> tags. The body tag has 'bgcolor' and 'font' attributes to set background color and font type.
There is a Head tag that comes before the Body tag, which contains extra information about the web page content and also contains the web page title (in the form of title tag).
Here is a sample structure of a web page source code:

<html>
<head>
<title>
"Title of Web Page Goes Here!"
</title>
</head> <body>"This text is displayed, while the rest are tags!"</body>
</html>

For Text in Websites

Here are the basic text formatting tags.
  • <b> . .</b> (Bold): Text enclosed in this tag appears bold.
  • <i> . .</i> (Italic): Text enclosed in this tag appears Italicized.
  • <u> . .</u> (Underline): Text enclosed in this tag appears underlined.
  • <p> . .</p> (Paragraph): Text enclosed in this tag, constitutes a paragraph. This tag has an extra attribute of 'align= center/left/right'.
  • <br> . .</br> (Break): This tag gives a break within the sentence and starts text on the next line

For Links

In case, one wants to hyperlink a phrase in the text body of the web page, to create a link from that page to another web page, one must use the link tag which is:

<a href="(webpage URL)"> (Phrase to be linked)</a>

For Images

Img tag has an 'Alt' attribute to describe the image and 'height' and 'width' attributes to adjust image size. To embed an image, use the tag as given below.

<Image src="(image URL)" height= "Pixel size" width = "pixel size"> . . .</Image>

For Fonts

HTML code for websites, that defines the font for a text is the tag. You can even define the size of the font, along with the font family. It is used as follows:

<Font face="" size= ""> . .</Font>

For Tables

You can create tables using HTML. This is done using the <Table> . . <Table> tags. Here is the code for creating a standard table (the <tr> . . </tr> tags are for creating a row and a cell within a row):
<table>
<tr><td>HTML</td><td>Codes</td></tr>
<tr><td>For</td><td>Websites</td></tr>
</table>

There are codes for colors of various shades, which can be used to color the background or text. So, these were some of the basic HTML codes used in websites, that you absolutely must know. Here covered only a few that are required to create a simple web page.