Web Design Tutorials 4: HTML5 Attributes

After defining HTML5 Tags and Elements in the previous section, we are ready to learn HTML5 Attributes.

HTML5 Attributes:

Actually HTML5 attributes add or provide more information about the HTML5 elements. All HTML elements can have attributes and they are always specified in the start tags. They usually come in pairs like: name =”value“.

Here are some HTML5 attributs:

    • lang attribute: This is to declare the document language. lang is declared inside <html> tag. Declaring a language is important for accessibility applications (screen readers) and search engines. have a look at codes below and focus:

      The first two letters specify the language (en). If there is a dialect, use two more letters (US).

  • title attribute: It displays a tool-tip on the screen while mouse hovers on the element. title can be added as attribute to the most of the tags, as below you can see that title attribute is added to the <p> element.
  • alt attribute: an alternative text when an image cannot be displayed on the screen.

    In the above code, if the image was not displayable because of any reason; the alt text will be displayed.
  • src attribute: the source attribute is used to give a path to catch the image or any other file like javascript. below example describes:
  • size attributes: HTML images are defined with the <img> tag. The filename of the source (src), and the size of the image (width and height) are all provided as attributes; here width and height are the size attributes.
  • href attribute: The links inside the HTML5 are declared inside the href attributes in the <a> tags.

Next we will discuss More about HTML5 Tags and Elements in deep, stay tuned with CODEJOW.