HTML Basics

tags:

HTML stands for Hyper Text Markup Language. It is a formatting language used to define the appearance and contents of a web page. It allows us to organize text, graphics, audio, and video on a web page. For the proper display of a web page you need a quality web hosting service provider.

Key Points:

  • The word Hypertext refers to the text which acts as a link.

  • The word markup refers to the symbols that are used to define structure of the text. The markup symbols tells the browser how to display the text and are often called tags.

  • The word Language refers to the syntax that is similar to any other language.

HTML was created by Tim Berners-Lee at CERN.

HTML Versions

The following table shows the various versions of HTML:

Version Year
HTML 1.0 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.0 1999
XHTML 2000
HTML5 2012

HTML Tags

Tag is a command that tells the web browser how to display the text, audio, graphics or video on a web page.

Key Points:

  • Tags are indicated with pair of angle brackets.

  • They start with a less than (<) character and end with a greater than (>) character.

  • The tag name is specified between the angle brackets.

  • Most of the tags usually occur in pair: the start tag and the closing tag.

  • The start tag is simply the tag name is enclosed in angle bracket whereas the closing tag is specified including a forward slash (/).

  • Some tags are the empty i.e. they don’t have the closing tag.

  • Tags are not case sensitive.

  • The starting and closing tag name must be the same. For example <b> hello </i> is invalid as both are different.

  • If you don’t specify the angle brackets (<>) for a tag, the browser will treat the tag name as a simple text.

  • The tag can also have attributes to provide additional information about the tag to the browser.

Basic tags

The following table shows the Basic HTML tags that define the basic web page:

Tag Description
<html> </html> Specifies the document as a web page.
<head> </head> Specifies the descriptive information about the web documents.
<title> </title> Specifies the title of the web page.
<body> </body> Specifies the body of a web document.

The following code shows how to use basic tags.

<html>
   <head> Heading goes here…</head>
   <title> Title goes here…</title>
   <body> Body goes here…</body>
</html>

Formatting Tags

The following table shows the HTML tags used for formatting the text:

Tag Description
<b> </b> Specifies the text as bold. Eg. this is bold text
<em> </em> It is a phrase text. It specifies the emphasized text. Eg. Emphasized text
<strong> </strong> It is a phrase tag. It specifies an important text. Eg. this is strong text
<i> </i> The content of italic tag is displayed in italic. Eg. Italic text
<sub> </sub> Specifies the subscripted text. Eg. X1
<sup> </sup> Defines the superscripted text. Eg. X2
<ins> </ins> Specifies the inserted text. Eg. The price of pen is now 2015.
<del> </del> Specifies the deleted text. Eg. The price of pen is now 2015.
<mark> </mark> Specifies the marked text. Eg. It is raining

Table Tags

Following table describe the commonaly used table tags:

Tag Description
<table> </table> Specifies a table.
<tr> </tr> Specifies a row in the table.
<th> </th> Specifies header cell in the table.
<td> </td> Specifies the data in an cell of the table.
<caption> </caption> Specifies the table caption.
<colgroup> </colgroup> Specifies a group of columns in a table for formatting.

List tags

Following table describe the commonaly used list tags:

Tag Description
<ul> </ul> Specifies an unordered list.
<ol> </ol> Specifies an ordered list.
<li> </li> Specifies a list item.
<dl> </dl> Specifies a description list.
<dt> </dt> Specifies the term in a description list.
<dd> </dd> Specifies description of term in a description list.

Frames

Frames help us to divide the browser’s window into multiple rectangular regions. Each region contains separate html web page and each of them work independently.

A set of frames in the entire browser is known as frameset. It tells the browser how to divide browser window into frames and the web pages that each has to load.

The following table describes the various tags used for creating frames:

Tag Description
<frameset> </frameset> It is replacement of the <body> tag. It doesn’t contain the tags that are normally used in <body> element; instead it contains the <frame> element used to add each frame.
<frame> </frame> Specifies the content of different frames in a web page.
<base> </base> It is used to set the default target frame in any page that contains links whose contents are displayed in another frame.

Forms

Forms are used to input the values. These values are sent to the server for processing. Forms uses input elements such as text fields, check boxes, radio buttons, lists, submit buttons etc. to enter the data into it.

The following table describes the commonly used tags while creating a form:

Tag Description
<form> </form> It is used to create HTML form.
<input> </input> Specifies the input field.
<textarea> </textarea> Specifies a text area control that allows to enter multi-line text.
<label> </label> Specifies the label for an input element.