Attribute is a term that is used in various fields of IT. Generally, an attribute is used to describe a file or a data field in more detail. In object-oriented programming, attributes are a property or characteristic that can be assigned to an object (element). Using attribute specific values can be assigned to certain elements.

Areas of application[edit]

The three most common areas where attributes are used in the IT field are:

  • Data Processing: Here attributes are used to specify files. Common file attributes include the size or date of creation.
  • HTML: In HTML, attributes serve as tags to define objects further.
  • XML or SGML: In these languages, the properties of elements or variables are defined by attributes.


Attributes in HTML tags[edit]

Attributes are commonly used in HTML tags and have different characteristics. However, only certain attributes are allowed as part of the W3C standards.


Within an element (here an h2 tag) an attribute is set directly at the beginning followed by an equal sign. The attribute value is then defined in the quotation marks.



There are some common attributes that can be used for all HTML elements:

  • title attribute: This attribute assigns a title to the particular HTML element. Such a title may appear on the website as a tool tip, for example, when the user moves the cursor over it.
  • href/src attribute: This specifies an URL for a web address or an image contained in HTML code.
  • width/height attribute: These attributes define the size of graphics.
  • alt attribute: This attribute is used to define an alternate description text for graphics in the source code. It appears when the file cannot be loaded by the browser. ALT attributes are also used for equal access websites (i.e. accessible to disabled people).

Using multiple attributes[edit]

It is possible to accommodate multiple attributes in one tag. The individual attributes are separated by spaces.



Attributes such as the class attribute and id attribute are frequently applied visual design HTML elements using CSS (Cascading Style Sheets).

It should be noted that the formatting of websites should always be done through style sheets. The reason for this is that the W3C considers attributes that only serve formatting purposes “deprecated.” Good HTML style separates content from layout.


Most HTML attributes are optional. If you integrate an image into a website with an img tag, in addition to specifying its source with an src tag, an ALT attribute should also be assigned to display an alternative text if the image cannot be displayed.

An example of optional but very useful attributes are title attributes. If an Internet user briefly hovers with the cursor over a link, he will get a brief description of the link target through this attribute. This would make it more user-friendly and easier to navigate. Such a title attribute could be implemented as follows. the Preparationof chocolate...</ p>

Attributes are definitely relevant to online store operators as well. Users can compare and find various products through Google Shopping. Correct HTML markup is enormously important if an online store offers its products via the Google Base Product Feed (product search). Google describes all possible attributes, which are important for the Product Feed Specification in its Google Merchant Center.

Importance for search engine optimization[edit]

As a rule, Google considers the correct use of attributes an indication of the quality of a website. Title and alt attributes can be beneficial for on-page SEO. The alt attribute, for example, has a great influence on image SEO because this attribute provides a reference concerning the image content, which the crawler might otherwise only get through the embedded content. Title attributes have long been considered an important optimization factor for linking. Keywords were not only used in anchor text, but also in the title as part of link building. Today, SEOs should be careful when using anchor text and titles for external links to avoid keyword stuffing. For internal linking, however, title attributes can be of some benefit, by giving users and the Googlebot an indication of what to expect on the target page.