Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Links
Links

Anchor element <a> is used to link web pages, images or any other content in html document. a stands for anchor annd used as hyperlink to create chain of links it has href attribute for linkage.

Syntax

<a href=URL/Address>link text or image</a>

or

<tag><a href=URL/Address>link text or image</a></tag>


You can use anchor element any where within an HTML document.


Attributes

  • href
  • target

Href attribute is used for linkge of web pages or documents with other documents for more detail visit href attribute

Syntax

<img src=image location alt=about image />

Target Attribute

Target attribute is used for location of opening of document following are the five locations where your anchor images or any anchor document will be opened.


  • _blank
  • _self
  • _parent
  • _top
  • frame
_Blank

_Blank opens any anchor document in new window or tab.


_Self

_Self opens any anchor document in same window or frame by default.


_Parent

_Parent opens any anchor document in parent window or frame.


_Top

_Top opens any anchor document in full sized window.



Anchor is a pair tag and output of anchor is link text or image like you can see in above examples.


Practice Task1

Open notepad or any other text editor, follow the following points.


  • Create an anchor element
  • Put a image as anchor link

save file with name task.html or task.htm and then open it using any browser and see results.


Solution


Don't forget anchor is non empty element which means it always comes in pair.


Practice Task2

Open notepad or any other text editor, follow the following points.


  • Create a web page and create bookmark inside page using anchor <a>
  • Create ul list of four items home, profile, about, contact in a page
  • Assign ids to each item like #home, #profile, #about, #contact
  • Write heading for each item like Home, Profile, About and Contact
  • Write two line paragraphs for each item home, profile, about, contact
  • Use CSS margin top property for each item
  • 50% for home, 20% for profile, 20% for about, and 20% for contact
  • Now create bookmark link for each item

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

Bookmark Page

Home

Welcome To Home

We are happy to see you here thanks for visit.

Profile

My name is XYZ

I am Software Engineer.

About

This all about website

teachMeCoding is the best learning site ever.

contact

Here you can contact us

  • Facebook
  • Twitter
  • E-mail
  • Instagram

Don't forget anchor is non empty element which means it always comes in pair.