Home » HTML Tutorial » Html anchor tag example | a Tag Attributes Explained – CodeMirch

Html anchor tag example | a Tag Attributes Explained – CodeMirch

Html Anchor Tag Example

We are sharing basic Html Anchor Tag Example for beginners to get understand easily.



Html anchor tag example

In this lesson we will cover up html anchor tag example and its attribute for our beginners to get easily understand. Now Lets describe the Anchor tag. The tag is used for hyperlinking to one page to other pages in html.


Watch Our Html Video :





Let’s See Our Basic Anchor Tags Example :


<head><title>Anchor tag example</title></head>


<p>This is a <a href=”#”>Linkable Paragraph</a></p>



In this Section, We have shown html structure with anchor tag example clearly.Firstly We declared title tag in the header section. Later on we shown paragraph tag in the Html body section. After  you can see that we have used the anchor tag for hyperlink the specific Word or Para into the html page.

<a href = “#”>Hello<a> Example :

Here We used anchor tag and its attribute “href”.  We have seen that  “Hello” is hyperlinked by #.

How to link something in html With anchor tags :

Lets See how to link something word in html with anchor tags. See Our Example

  • <a href =”example.co.in”> Test </a>

Html anchor target Example

Here We are covering how to target anchor link in html pages. Let’s See Example

a href target blank :

  • Example : <a href = “#” target=”_blank”>Test</a>

HTML anchor tag attribute – :

List of attributes are shown  in this section, Let’s See Example

  1. _blank = Open Link in New Windows.
  2. _self =     Open Link in Same Pages.
  3. _top  = Open link with the full body of Windows.

How to create a download link on your website with <a> tag ?

Here we are showing how to create a download link on a website using anchor tag download attribute.

  • Example :  <a href=”file destination path” download>Download Link </a>

HTML5 anchor <a> name Attribute Example :

In this session We are given an example of <a> tag with its attribute name.

  • Example :  <a href = “#” name = “anchor”> Anchor Name</a>

Anchor tag in PHP Example :

Here We will see how to link <a> tag in PHP Script in html Pages.

Example :




                   Anchor tag in PHP




$str = “Click this link”;

Print”<a href= ‘#’>$str</a>”;


In this section we used <a> tag in the PHP file. If you want to check this code, So first to download XAMPP Server and install it & run this server. Then you will open PHP file, paste the PHP Code, and save it in the htdocs folder with extension .php.Finally, you will open local host and run this script in PHP pages



, , , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *