Thursday, June 2, 2011

Use of a tag in HTML, and some special tags

Use full tags:

To Comment code section that you don't want to display when you load a Web page in a browser, or just for the code section related information.

<!--
..
..
..
-->

Any code written in the section will not be render on the browser.

Example:

<!--
Comment Section of the Code Start
<div>
<span>Hello World</span>
</div>
Comment Section of the Code End
-->

When you will load this code snippet into browser, web page will not display "Hello World". It will consider it as a comment.

<i>...</i> is use to make font in italic style
<b>...</b> and <strong>...</strong> tags are used to make font Bold
<br /> to insert a line break, to start new line

<a> tag is know as hyperlink, link tag is use to link with another document, or to bookmark within same Web page.

Most important attribute of this tag is "href", that is a reference of the linked page/document or section of the page.

Hyper-linking Code:
<a href="myfirstpage.html">Go to First Page</a>
<br />
<a href="mysecondpage.html">Go to Second Page</a>

Suppose we have 3 html pages in the same folder / directory.
i.e index.html,  myfirstpage.html and mysecondpage.html

myfistpage.html and mysecondpage.html contains its own defined contents.
In page index.html we place code as defined above in hyper-linking code example. This code section will be defined within body section of this HTML document. When you done this, open this index page into browser, you'll see two links as mentioned. Here, when you click "Go to First Page", it looks for href that represents myfirstpage.html in the  same folder. It will load href page into browser.

For Linking Bookmark, within page:


Within href ="#bookmark", # sign is used for the code section that will contain same id. Please look this image








No comments:

Post a Comment