Attributes

Attributes provide additional information about an element. They are always specified in the start tag.

It is recommended quote attribute values to a single or double quotes.

<h2 id="myidvalue">My header</h2>

<img src="/images/myimage.jpg" alt="Here must be 'myimage.jpg'. " >

<p style="color:red; text-align: center;" >red paragraph</p>

<table class="w-100 table-bordered">
...

Below are the most important attributes.

attributedescription
id Specifies a unique id for the element. Must contain at least one character. Must not contain any space characters.
Used in css, javascript and as anchor for links.
class Specifies one or more class names separated by space for an element. Naming rules:
  • first letter A-Z or a-z
  • next letter is one of the A-Z, a-z, 0-9, _, -
style Specifies an inline style for an element. More details about css rules see CSS.
title Advisory information related to the element it belongs to. May contain several lines, each U+000A (LF) character represents a line break. Typical uses is as tooltip:
  • labeling iframe elements
  • providing a programmatically associated label for an input element as a fallback for a real label
  • labeling controls in data tables