Attribute as a characteristic or property

Attribute definition

The attribute basically has the task of describing a data field or a file in more detail. Within object-oriented programming, the attribute means a characteristic or property that can be assigned to an element or object. Attributes can be used to assign concrete values to a certain element.

Application areas for attributes

In data processing, attributes are used to specify files. Common file attributes are, for example, the date of creation or the size. In HTML, attributes are used as tags to define objects more precisely. In SGML or XML, attributes are used to define properties of variables or elements. In HTML tags, attributes are often used, which have different characteristics. However, only special attributes are permitted in the so-called W3C standards.

Structure of an attribute

In elements (such as h2 tags), the attribute is placed immediately at the beginning, followed by the equal sign. The attribute value is then defined in inverted commas. The title attribute gives HTML elements a title. The href/src attribute specifies an image URL or a URL. The width/heigth attributes help to define the size of graphics. The alt attribute is used when an alternative description text for the graphics is stored in the source code. This is displayed if the files in question cannot be loaded by a browser. Accessible websites also use ALT attributes.

Use of multiple attributes

Several attributes can be accommodated in one tag. The different attributes must be separated by spaces. The id attribute and the class attribute are often used to visually design HTML elements with the help of CSS. It is important to note that websites should be formatted using style sheets.

Importance with regard to search engine optimisation

The correct use of attributes indicates the quality of websites for Google. OnPage search engine optimisation can be supported by alt and title attributes. With regard to image SEO, the alt attribute has a great influence. Through the attribute, search engines are given a hint to the text content, which crawlers can otherwise only infer through an embedding content.

For a long time, title attributes were considered an important optimisation factor with regard to linking. When building links, the keyword was not only used in the anchor text, but also in the title. Today, one should be careful with title and anchor text, especially with external links, in order to avoid keyword stuffing. For internal linking, title attributes can also be beneficial, as users and Googlebot receive hints about what to expect on the target page.

nach oben