Search This Blog

Monday, 10 October 2011

HTML Introduction

What is HTML?
HTML stands for Hyper Text Markup Language.
HTML elements are the basic building-blocks of webpages.
HTML is written in the form of HTML elements consisting of tags, enclosed in angle brackets (like <html>), within the web page content.
HTML  has an open tag and an end tag, in between these tags web designers can add text, tags, comments, and other types of text-based content.

HTML Structure

HTML, or hypertext markup language, is very simple to learn and very simple to use. HTML is used in most
modern websites. HTML has two basic forms:
<name attribute1="value1" attribute2="value2">Content of 'name'</name>
and
<name attribute1="value1" attribute2="value2">
After learning the basic form of HTML, it is easy to do some HTML coding.

HTML pages always start with a DTD, or document type definition. This allows the web-browser to determine what type of HTML you are using as well as what language the characters are in. The type of DTD that I would recommend is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
After the DTD, you would continue with the HTML tag, like so:
<HTML>
...
</HTML>

HTML pages are broken into two main sections: the HEAD and the BODY, both contained within the HTML tags.
The head contains the title and sometimes meta tags. The body contains the main page that everyone sees. A typical
website looks something like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
...
</HEAD>
<BODY>
...
</BODY>
</HTML>

Let us create a basic HTML page

First open your text-editor, let us use Notepad here. So, open your Notepad and type the Below Content

<HTML>

<HEAD>

<TITLE>My First HTML</TITLE>

</HEAD>

<BODY>Hi! This is my First HTML Page</BODY>

</HTML>
The above format is the most general approach for any html page.

In the 'Title tag' we can give the Title for the Page and in the 'Body Tag' we can add content for the page body.

After typing the above code save your file with some name ending with .html extension. For eg save the page with name 'SamplePage.html'.

Go to your directory where you have saved your html page and you will find a small icon as shown in below fig:



Now, double click on that icon and you will open your HTML page, Otherwise you can directly open your browser and in the url give the address where the file is saved. Say for example C:\Users\UserName\Desktop\SamplePage.html.

Your Page will appear as shown below :






As you can see your page has title 'My First HTML' and its body 'Hi! This is my First HTML'.




No comments:

Post a Comment