Monday, November 01, 2010

HTML Links with Target attribute

The target attribute specifies where to open the HTML link, i.e., either in the same page or in a new browser window or in a new tab of the same browser.

The General format/syntax to open a link in a new browser tab is:

<a href="[URL/Address]" target="_blank">[Link Text]</a>


In creating a HTML link with the target attribute the same <a> tag is used with the "href" attribute and is followed by the the URL/address of web page by replacing [URL/Address] in the syntax. The [Link Text] is replaced by the text to be shown in the link.

For Example:
Input:
<a href="http://muhammadalikhansblog.blogspot.com" target="_blank">My Blog</a>
Output:
My Blog

This example will open the webpage http://muhammadalikhans.blogspot.com in a new browser tab.
If you are new to learning about HTML, click here to learn about creating basic HTML links.

No comments:

Post a Comment


Ali Khan Blogs is a Blog about Blogging and SEO Tips and Tricks for Newbie Pakistani and Indian Bloggers