HTML Attributes

  • HTML Attributes provide the additional information about HTML elements.
  • Attributes are always specified in the start tag.
  • Attributes usually comes in pairs.

lang Attribute

This attribute helps in declaring the language of the document. Lang Attribute in case of whole document is declared in the html tag.
<!DOCTYPE html>  
<html lang="en-US">  
href Attribute
This attribute is embedded with the anchor tag (<a>) where href specifies the address of the link.
<a href="">Tutorial and Example link</a>

Size Attribute

It defines the size i.e. Height, Width of an image, gif, buttons etc. It can easily understand with the image properties as shown below.
<img src="te.jpg" width="104" height="142">

Alt Attribute

It provides an alternate text when an image cannot be displayed. This text is displayed when due to any reason image is not loaded but user can read the alternate text to get the reference information about image.
<img src="w3schools.jpg" alt="" width="104" height="142">
Style Attributes
It helps in styling of the HTML element. It has the following syntax:
<tagname style="property:value;">
1) <h1 style="color:blue;">Tutorial and Example</h1>
2) <h1 style="font-size:300%;">Tutorial and Example</h1>

Tutorial and Example


Tutorial and Example