An attribute is a certain property of an HTML element that is defined within the HTML tag. A typical example is the attribute named "id":

<div id="mytext">Some text goes here...</div>

Attributes in HTML tags can be divided into standard attributes, event handler attributes and tag-specific attributes.

Standard attributes are available for nearly every HTML tag, like the mentioned "id" attribute, or:

<div class="texts">Some text goes here...</div>
<div title="this is a tool tip">Some text goes here...</div>

Event attributes are a way of registering script event handlers to HTML tags, examples are:

<div onclick="myFunction()">Some text goes here...</div>
<div obdblclick="anotherFunction()">Some text goes here...</div>

Tag-specific attributes can only be used in certain HTML tags, such as:

<meta http-equiv="cache-control" content="no-cache"/>

(Note, that this tag is written in XHTML)

Switch to:

Suggestions about this definition? Please contact the author: Contact form