Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Href Attribute
Attributes

In HTML attribute is used to provide extra information about elements.


  • Every Element can have Attributes
  • Every Element can have Attributes
  • the writing way of attribute is name=value.

Any attirbute of an element is defined once within an open tag.

Syntax

<tag name=value>Content</tag>


There are hundereds of HTML attribute but some common attributes are.


  • href attribute
  • src attribute
  • alt attribute
  • title attribute
  • lang attribute
  • style attribute
  • id attribute
  • class attribute
Href Attribute

href attribute is used to provide address information for links element <a></a>. The href full form is hyper reference. By using href attribute you can link hundreds or thousands pages, images and any other documents with each other.

Syntax

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



Now if you remove your picture from directory and run above code it will show you alt text which is bulb.


Practice Task

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


  • Create html page
  • Use href attribute and link it with other html page or image
  • Use <br /> element if neccessary otherwise leave it

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


Solution

image

In example the link name was some text like click me but in task link name was an image, so you can use any document to link with other document.