HTML5 Attribute Tutorial And Reference

Published on: September 9, 2014   Last Updated on : December 8, 2014   Posted By : WebDesignReference

What’s an attribute in HTML5 ?

An attribute is an additional behaviour or property of an element. It is specify within an element like title attribute, language attribute, href attribute etc.

Example : <a href=”” title=”home-link”>This is a home page link</a>

Here “Href” and “title” are additional behaviour of an element.

There are some common Attribute in HTML5 :

  • Class : It is used for defining class of an element.
  • Id : It specifies id or name of an element.
  • Style: this behaviour is used for styling of an element.
  • Title : It is used for title or tooltip of an element.
  • Alt: It is used for alternate text of an image.
  • Src: This is used for source path of an image.
  • value : It specifies the value of an element.
  • Href : It specifies the link url.

There are some new Attribute for form in HTML5 :

  • autocomplete : Example of Autocomplete attribute in html5:
    <form action=”submit-page.html” autocomplete=”on”> First name:<input type=”text” name=”first-name”><br> Last name: <input type=”text” name=”last-name”><br> E-mail: <input type=”email” name=”email” autocomplete=”on”><br> <input type=”submit” class=”submit-button”> </form>
  • novalidate : Example of Novalidate attribute in html5:
    <form action=”submit-page.html” novalidate> E-mail: <input type=”email” name=”email” autocomplete=”on”><br> <input type=”submit” class=”submit-button”> </form>

There are some new commonly used Attribute for Input type in HTML5 :

  • Autocomplete
  • Autofocus
  • Height
  • Width
  • placeholder
  • required