×

Html & Html5

The World's best Software Development Study Portal

HTML Attribute


  • All HTML elements can have attributes.
  • Attributes provide additional information about an element.
  • Attributes are always specified in the start tag.

Following are Examples of attribute:-


1. href attribute: href Attribute specified link address.
    Example:




Output:


link

2. src attribute: src attribute is used with image tag to provide the path for image to be displayed.      It is used as below:
    Example:




Output:


himalayas


3. alt attribute: It is used to show alternate text if image is not displayed.The value of alt    attribute should describe the image.It is used as below:
   Example:




Output:

Himalayas


4. width and height attribute: Width attribute is used to set the width of an image.Height    attribute used to set the height of an image.It is used as below:


Example:



Output:


himalayas


5. HTML style attribute: With style attribute,we can provide style to our HTML element.
  The HTML style attribute has the following syntax:


Syntax:


Example:



Output:


backo