HTML tags can contain attributes that are tag related information or properties. The general attribute syntax is:
<div attribute_name = "Property1 Property2 "></div>
Each tag has its own attributes, for example the tag <a>
is
generaly combined with the attribute href =" ... "
which creates a link to
another page.
You'll learn later that it is possible to create custom attributes for your own needs.
The most used attribute is id
which identifies a tag in particular. The following
example shows the syntax for associating an identifier to a tag <h1>
:
<h1 id="ID_name">My title</h1>
However, the following constraints should be considered:
-
and _
but compatibility is not
ensured with previous versions. These characters tend nowaday to be
democratize.