Friday, September 5, 2014

chapter 1

Here, we will introduce you to the basics of HTML. HTML stands for Hyper Text Markup Language. Using HTML we can create a Web Page which can be viewed through a Web Browser over Internet.
HTML describes the contents of a web page with Markup Tags. Tags are defined by angle brackets <>. <> is called the Opening Tag or the Start Tag. The Closing Tag or the End Tag is defined as </>. The whole HTML document is enclosed in between the opening tag and the closing
tag. An HTML file has a .html or .htm extension.

The General Structure of an HTML document

When you will open a web browser and going to the View option of the Menu bar click to view the source code of the web page, you will see the general structure of the HTML document. At the start of the document, you will find the declaration of the HTML Version being used.
An HTML document is divided mainly into two parts- Head and Body. The Head element contains the Title of the Page which is written in between ... tags. The Title of the Page will be shown in the Header of the Web Page.
The second part is the Body Element. This is the most important part of the HTML document. The Body element contains all the contents to be displayed in a web page (texts, images etc.).
Below here is the General Structure of an HTML document---
"http://www.w3.org/TR/html4/loose.dtd">
 ...... Version of HTML


...... Opening of the HTML document



...... Opening tag of the Head

My Home Page ...... Title of the document

...... Closing Head tag


...... Start of the Body
............................
........Contents of the body 
which may contain various kind
..............
of elements like text, image, link etc
................................................................
...... End of the Body element


...... End of the HTML document

Basic Elements of a Body and their Attributes

The following Basic elements are used in a body that describe the contents of the body---
  • Headings
  • Paragraph
  • Formatting Elements
  • Emphasized word
  • Image
  • Anchor
  • Lists
Each element has some properties or characteristics. These are referred to as attributes. An attribute has a specific value.


HTML Headings

In HTML, six types of headings are used, viz, H1, H2, H3, H4, H5 and H6. Headings are important in maintaining the flow of the contents, i.e., the hierarchical structure of the document. H1 is the most important and H6 is the least important heading.
Each heading has an Opening tag and a Closing tag. The use of headings can be shown as below---

This is the first heading


This is the second heading


This is the third heading


This is the fourth heading


This is the fifth heading

This is the sixth heading

In the browser, it will become like this---

This is the first heading

This is the second heading

This is the third heading

This is the fourth heading

This is the fifth heading
This is the sixth heading
The format of the text in each heading is defined as default by HTML itself.

Paragraph

Paragraphs in an HTML page are encoded within and
tags. However, the end tag is optional. The space between two paragraphs are automatically specified in HTML. We can insert a line break at any point of the document by using a
tag.
Look at the follwing example---
This is my first paragraph.

This is another paragraph. This will give you
an introduction of HTML.

The display in the web page will be as---
This is my first paragraph.
This is another paragraph. This will give you
an introduction of HTML.

Formatting Elements

There are three basic formatting elements used in HTML to make a text Bold, Italic and Underlined.
To make a text bold, and tags are used.
To make a text italic, and tags are used.
To make text underlined, and tags are used.
For example,
This text is bold.
This text is italic.
This text is underlined
The result will be---
This text is bold.
This text is italic.
This text is underlined.

An Emphasized Word

To add emphasis to a word or a group of words, we use the tag.
For example,
This is a very interestinglesson.
This is a very interesting lesson.

Image

Images are often used in a web page. To add an image in HTML, we use the tag. The path of the location of the image is written in the "src" attribute. If the image is located in the same folder as the web page then only the name of the image file is included. We can also format the size of an image by specifying its width & height.
Take the following example:

This is an image with size of width 100px and height 80px.
The ALT attribute of an image:
The Alt attribute is used to give a short description of an image in case the image is not loaded in the web page due to some reason.
picture of a boy
picture of a boy Here, in place of the image the text is displayed contained in the alt attribute of the image.

The Anchor Element

HTML provides the facility of links in a web page to other web pages. By clicking on some text as a link, we can go to a different web page. This is called Hyper Linking of web pages. This makes a web page dynamic.
The anchor tag is used for this purpose. The location path of the web page to be linked is given in the "href" attribute. Href refers to Horizontal Reference. The text which is displyed as a link to the desired page is written in between the opening and closing tags.
text as the link
For example,
Go to Roseindia will create a link to the Roseindia Web Site.
Go to Roseindia
On clicking the above link, the Roseindia Home Page will be open.

Lists in HTML

Three different types of lists are used in HTML. Unorderd list, Ordered list and Definition list.
(i) Unordered list is one in which the listing of the items is unordered. The
    tag defines an Unordered list and items are described by the
  • tag. The Bullets appear as the default style in an Unordered list. We can also specify the style format as "circle" or "square" in the type attribute.

For example,
List of some fruits:


  • Apple

  • Banana

  • Orange

  • Mango


List of some fruits:
  • Apple
  • Banana
  • Orange
  • Mango
(ii) Similarly, an Ordered list is defined by
    tag.

For example,
List of some vehicles:


  1. Bicycle

  2. Motorbike

  3. Car

  4. Bus


List of some vehicles:
  1. Bicycle
  2. Motorbike
  3. Car
  4. Bus
1,2,3,....is the default ordering style (type="1") in an Ordered list. The type of ordering can be changed by specifying the value of the type attribute as "i" for Roman, "A" for alphabets etc.

(iii) A Definition list is one in which definition or description of the items are given. A Definition list is defined by
tag. The items are encoded in
(defintion term) tag and the description of the items are encoded in
(definition data) tag.

For example,
List of some beverages:


Tea

A type hot drink

Coffee

Another hot drink


List of some beverages:

Tea

A type of hot drink

Coffee

Another hot drink
All three
    ,
      ,
      has closing tags. But
    1. is optional.

No comments:

Post a Comment