All HTML documents have a certain basic structure that must
be adhered to:
- The
entire document is enclosed in
<html>tag. - The
second tag in the document is
<head>tag. This tag is used to contain other tags, which hold information about the document, such as its title. Item in the<head>tag are not displayed to the user. - The
head tag is followed by the body tag. The
<body>tag contains the document content.
The simplest possible HTML document is made up of these
three tags, as shown here:
<html> <head> </head> <body> </body> <html>
This document is empty and, if loaded into a browser, will
simply display a blank page.
The <!DOCTYPE> Tag
Strictly speaking, every HTML document should start with
a <!DOCTYPE> element. This is a
stand-alone tag that is placed before the first <html> tag. Its purpose
is to provide information about the version of HTML that the document uses.
With this information, the browser can precisely interpret the document’s HTML
tags. Without it , the browser has to guess and may not render things as
precisely as you like.
Most web pages omit <!DOCTYPE>
tag and work just fine. Even so, I recommend using it.
With this tag, your basic HTML document looks like this:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” http://www.w3.org/TR/html4/loose.dtd> <html> <head> </head> <body> </body> </html>
I will explain other
<!DOCTYPE>
definitions as we proceed in other posts.
Information Tags
Document information tags are placed within the
<head> tag. There are only two
information tags that you need to know at this point: the <title> tag and the <meta>
tag.
The <title> Tag
This tag defines the document’s title. This is important
because most browsers display the document’s title in the title bar. If a
document does not have a title, the browser will display its URL or the name of
the browser instead. Also search engines such as Yahoo! And Google rely on page
titles to help locate, index and categorize the pages properly. You should
select a short title that describe your page actually. Simply include the title
in the document head and you are all set:
<head> <title>Vikas Dangi Web Page</title> </head>
What’s a URL?
URL stands for Uniform Resource Locator. This is just a
fancy name for a Web address such wbuhc.blogspot.com.
Sometimes, you will see URLs written with http:// at the beginning. This is not
a part of the URL but is used to specify the protocol or data transfer method
that the browser will use. A URL identifies the location of a resource (a file)
on the Internet. There are at least two parts to this: the name of the Web
server where the file is located and the name of the file. Sometimes, a third
part is added as well, identifying the folder on the server where file located.
Let’s look at some examples. wbuhc.blogspot.com is a URL that
identifies a specific Web server but without a file name. If someone navigates
to this URL they will get a file-a Web page-because the server is programmed to
return the default page in this situation. Essentially, all Websites have a
default page and it is often named index.html. wbuhc.blogspot.com/index.html
is a URL that includes a file name. It specifies a certain file, index.html, in
the default, or root, folder on the Web server. wbuhc.blogspot.com/images/logo.jpg
is a URL that include a folder and a file name. It specifies the file logo.jpg
in the folder images on the Web server.
The <meta> Tag
The
<meta>
tag lets you include essentially any information you want in an HTML document.
A <meta> tag has two
attributes, name and content. You write a <meta>
tag like:<meta name='tag name' content='tag content' />
The
<meta>
stands on its own - there is no closing tag required. What do <meta> tags do? Nothing. It does
not affect how the document is displayed, but the information is available for
programs that are looking for it. For example many people use <meta> tags to include a
description and a list of keywords in a document. Many search engines are
programmed to look for these meta tags and use the information as an aid for
indexing the page.
For example if you were creating a Web page that explained
the basics of HTML, you could use
<meta>
tags to include a description and keywords like this:<meta name='description' content='Introduction of HTML' /> <meta name='keywords' content='HTML, Web page, Website design' />
More Information Tags
There are four more information tags that can be placed in
an HTML document’s head section. These have been described here briefly. With
this basic information, however, you will understand the tags should you see
them in an existing Web page. These tags will be explained later in the book as
advance editing comes.
<base> Defines a base URL that will
be used for all kinds on the page.<link> Links the HTML document to
another document such as a style sheet.<script> Identifies script code,
such as JavaScript, in the document.<style> Defines a style in the
document.
Simple Text
There
are two tags you need to know about when working with text.
The
<p> tag is used to define
paragraphs. A paragraph is set apart from other text by a blank line. Its width
depends on the size of the browser window, and the text will automatically wrap
to fit. To see how the <p> tag
works, look at this HTML (The head section is omitted in this and other
examples also because it does not affect the output). Then, see how it is shown
in a browser in the figure.<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' http://www.w3.org/TR/html4/loose.dtd> <html> <head> </head> <body> <p>This is the first paragraph in the document. It is enclosed in paragraph tags to set it apart from other text</p> <p>This is the second paragraph enclosed in its own set of paragraph tags. It separated from the previous paragraph by a blank line</p> </body> </html>
Out Put :
The
<br /> tag lets you start a new line of text without starting a new
paragraph. It is used alone, without any closing tag. See the example below and
you can see its browser displayshown in the next figure.<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” http://www.w3.org/TR/html4/loose.dtd> <html> <head> </head> <body> <p>When you report for your exam, please be sure that you have all of the following items with you:</p>< <p>Admit Card<br /> Pen and Pencil<br /></p> <p>Exam will begin at 9 am and go on till 11 am.</p> </body> </html>
Out Put :


0 comments:
Post a Comment