CLICK HERE FOR BLOGGER TEMPLATES AND MYSPACE LAYOUTS »

Saturday, November 1, 2008

Basic HTML Tags

The most important tags in HTML are tags that define headings, paragraphs and line breaks.


The best way to learn HTML is to work with examples. We have created a very nice HTML editor for you. With this editor, you can edit the HTML source code if you like, and click on a test button to view the result.


Try it Yourself – Examples

A very simple HTML documentThis example is a very simple HTML document, with only a minimum of HTML tags. It demonstrates how the text inside a body element is displayed in the browser.


Simple paragraphs

This example demonstrates how the text inside paragraph elements is displayed in the browser.

Headings


Headings are defined with the h1 to h6 tags. h1 defines the largest heading. h6 defines the smallest heading.

HTML automatically adds an extra blank line before and after a heading.

HTML Elements


HTML documents are text files made up of HTML elements.

HTML elements are defined using HTML tags.


HTML Tags
  • HTML tags are used to mark-up HTML elements

  • HTML tags are surrounded by the two characters and

  • The surrounding characters are called angle brackets

  • HTML tags normally come in pairs like b and /b

  • The first tag in a pair is the start tag, the second tag is the end tag

  • The text between the start and end tags is the element content

  • HTML tags are not case sensitive, b means the same as B

HTML Elements


Remember the HTML example from the previous page:


This is an HTML element:

The HTML element starts with a start tag: b

The content of the HTML element is: This text is bold

The HTML element ends with an end tag: /b


The purpose of the b tag is to define an HTML element that should be displayed as bold.


This is also an HTML element:


This HTML element starts with the start tag body, and ends with the end tag /body.


The purpose of the body tag is to define the HTML element that contains the body of the HTML document.


Why do We Use Lowercase Tags?


We have just said that HTML tags are not case sensitive: B means the same as b. If you surf the Web, you will notice that plenty of web sites use uppercase HTML tags in their source code. We always use lowercase tags. Why?


If you want to follow the latest web standards, you should always use lowercase tags. The World Wide Web Consortium (W3C) recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation HTML) demands lowercase tags.