HTML Lesson 3: Attributes



Attributes give |additional information” and inform the browser how to make HTML elements. This helps developers to customize web pages effectively. When the HTML tag is processed, the browser searches for these attributes as guides for the formation of web elements.

Please note: Attributes are always used in the start tag with a name/value such as: name=”value”. Without any value, the browser will form an Element using the default setting.

Let’s give you brief demonstration of commonly used Attributes. Following are few out of many attributes.


The language (lang) attribute defines the document language, and it is best to use in an <html> tag. Normally it’s used for better accessibility in browser and search engines. It will be written as lang in <html> tag, for example:

The “US” is used to represent dialect i.e. American English. While (en) is for English. As English is not the only language in the world. Developers of HTML understood it and allow to add ISO certified languages in HTML. Every language has a specific code normally two letters like “en” for English. These codes are ISO certified. Here is the complete list of Language Codes.


The title is a useful attribute to provide “additional information” to HTML Element in the form “tool tip.” Its get active only when you will hover mouse over text, it will show you the text mentioned in the title attribute. Basically, this attribute titles an HTML element and shows a pop-up to any HTML element.

Source Code Output

WikiProgramming HTML Tutorial

Hover your mouse over the Title Heading tag in output section and watch the title attribute in action!


As name tells Align attribute helps in aligning the text, div, image, or table data in left, center and right of content area. However, normally developers prefer to use it for the text only. Let’s give you a simple demonstration of how to use align attribute.

Source Code Output

Left-aligned text

Centered text

Right-aligned text

You can see that with align attribute we aligned the text left, center and right of content area.


Let’s reveal you a secret of how to define a path of a link. The answer is the href attribute. Sometimes, in fact most of times, href considered as a mandatory part of <a> tag. Because normally you will use the link only to take user to other page. Here is a simple demonstration of it.

Source Code Output
This is a link

Global Attributes

Each HTML elements have specific attributes which use for it only. However, there are some attributes which can use with every HTML elements. These are called Global Attributes. There are not lot of global attributes in HTML. They are few in numbers but has been very useful for example title, class, style  are global attributes. Here is the complete list of Global Attributes. Do check it out, because they will be very useful while development.


  • An HTML Elements can have HTML Attribute.
  • The HTML Attribute always use in start tag.
  • The HTML title attribute work as a tool-tip of text.
  • The HTML align attribute align the text in left, center and right.
  • The HTML href attribute provides address information for links.

Next Lesson

So you have got some basic knowledge of the HTML Attributes. Now let’s move to our next lesson which is HTML Text. Where you will learn to manage the text with different HTML tags


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.