Javascript AJAX jQuery HTML PHP Example MORE

HTML Link tag with Example

A link is specified using HTML tag <a>. The href attribute used to specifies the destination address (Ex.//www.studentstutorial.com) of the link.

syntax:

<a href="url">link text</a>

The tags used to produce links are the <a> and </a>.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Hyperlink Example</title>
</head>
<body>
    <a href="//www.studentstutorial.com">Visit our HTML tutorial</a>
</body>
</html>

Run it yourself

The <a> tag tells where the link should start and the </a> indicates where the link ends.Everything between these two will work as a link.

target Attribute of HTML links

The target attribute can have one of the following values:

  1. _blank - Is used to opens the linked document in a new window or tab.
  2. _self - Is used to opens the linked document in the same window/tab.
  3. _parent -Is used to opens the linked document in the parent frame.
  4. _top - Is used to opens the linked document in the full body of the window.

Example target _blank

<!DOCTYPE html>
<html>
<head>
    <title>Hyperlink Example</title>
</head>
<body>
    <p>Click following link</p>
    <a href="//www.studentstutorial.com" target=“ _blank ">Students Tutorial</a>
</body>
</html>

Run it yourself

Example target _self

<!DOCTYPE html>
<html>
<head>
    perlink Example</title>
</head>
<body>
    <p>Click following link</p>
    <a href="//www.studentstutorial.com" target=“ _self ">Students Tutorial</a>
</body>
</html>

Run it yourself