Jump to content

HTML Anchor ( Anchor آشنایی با مفهوم )


Adrian
 Share

Recommended Posts

  • Author

HTML Anchor

The HTML anchor tag defines a hyperlink that links one page to another page. It can create hyperlink to other web page as well as files, location, or any URL. The "href" attribute is the most important attribute of the HTML a tag. and which links to destination page or URL.

href attribute of HTML anchor tag

The href attribute is used to define the address of the file to be linked. In other words, it points out the destination page.

The syntax of HTML anchor tag is given below.

<a href = "..........."> Link Text </a>

Let's see an example of HTML anchor tag.

 
  1. <a href="second.html">Click for Second Page</a>  

Test it Now


Specify a location for Link using target attribute

If we want to open that link to another page then we can use target attribute of <a> tag. With the help of this link will be open in next page.

Example:

LINK

<body>
 
 <a href="https://www.adrianbahmani.com">adrianbahmani</a>
 
</body>

Linked image

<body>
 
<p>بروی تصویر زیر کلیک کنید</p>
 
<a href="https://www.adrianbahmani.com">
 <img src="images/logo-1.png">
</a>
 
</body>

Link to email

<body>
 
<a href="[email protected]?subject=test&body=test" target="_top">ارسال ایمیل</a>
 
</body>

Link to phone number

<body>
 
<a href="tel:+98۰۰۰۰۰">تماس تلفنی با ما</a>
 
</body>

Link to the top of the page

<!DOCTYPE html>
<html id="Top">
<body>
 
 <a href="#Top">برو بالای صفحه</a>
 
</body>
</html>

Nofollow

<body>

 <a href="https://Test.com/" rel="nofollow">Test.com</a>

</body>

Interesting link

<div style="text-align:center;">
 <a href="https://www.adrianbahmani.com/">adrianbahmani.</a>
 <a href="https://www.adrianbahmani.com/">adrianbahmani.</a>
 <a href="https://www.adrianbahmani.com/">adrianbahmani.</a>
</div>

Opening the link in different modes

<body>
 
<a href="https://www.adrianbahmani.com" target="_self">Self</a> <br>
<a href="https://www.adrianbahmani.com" target="_blank">Blank</a> <br>
<a href="https://www.adrianbahmani.com" target="_parent">Parent</a> <br>
<a href="https://www.adrianbahmani.com" target="_top">Top</a>
 
</body>

 

Link to comment
Share on other sites

  • Adrian changed the title to HTML Anchor ( Anchor آشنایی با مفهوم )

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...