Attributes in HTML

HTML allows you to put tags which decide upon how the content on your web page will appear. Now, if you wanted to add even more functionality to the HTML tags, you can give attributes to the HTML Tag.

  • Thus, HTML elements can always have attributes to them (Well, at least to most of them!).
  • Attributes are used to provide additional information to the HTML tag. Thus, the basic function of the HTML tag is always performed, but because of the attribute, an additional function is also perform with the basic function.
  • HTML Attributes can be specified only in the starting tag.
  • The format of presenting HTML attributes is in a name with value pair.

Thus, the <a> tag is used to provide a link on a web page.The href tag is used as a attribute to mention the URL, where the link should lead to.

<a href=””>Learn Web Scripting for free</a> leads to the Tags in HTML page.

This will appear like the below: –
Learn Web Scripting for free

In this example, you can see that,

  • <a> is the tag which is used to give a link in HTML. This tag is closed by a </a> as a End tag.
  • href is the attribute to mention the link.
  • The link is enclosed in quotes.
  • In between the opening tag and the ending tag, the text is mentioned (Learn Web Scripting for free) should be given the link.

While Double quotes are commonly used to mention the value, single quotes can also be used.

%d bloggers like this: