Attributes

Attributes provide additional information about the content of an element. They appear inside the opening tag and consists of a name (the attribute) and a value, separated by an equal sign. The name part indicates what kind of extra information you are providing. The value part is the setting of the attribute.

<p lang="no">Et element med norsk tekst</p>

In the example above the attribute *lang* indicates that you will give information about the language of the element. The value for this attribute is "no", indicating that the paragraph is in Norwegian.

Such attributes makes it easier for browsers to render the elements correctly, also it helps screen readers and those trying to make sense of your markup, e.g. search engines.

Last updated