In HTML and XML, attributes can be added to elements to control their effect. All attributes values are textual. In following example code, the <html> element has a lang attribute with value "en":

<html lang="en">...</html>

Attributes consist of a name and a value, separated by an "=" (equality) sign and are written within the starting tag of the element. If the attribute is a boolean then the value part and equality sign can be omitted.

Normally the value has to be contained within single (') or double (") quotes. In HTML, if the value does not contain spaces or any of the characters " ' ` = < >, then quotes are optional.

Data types and microsyntaxes

The different rules that can apply to attributes values are called data types in HTML 4, or microsyntaxes in HTML5.


Main article: Character data.

CDATA or Character data is the most basic data type, used for both attribute values and textual elements. All other data types are derived from CDATA, unless otherwise noted.

The only processing applied to this data type is replacing for character entities by their corresponding characters, and replacing each carriage return and tab with a single space.


HTML 4 describes the Text data type, for human readable text. Attributes that use the Text data type include abbr (<th> and <td> elements), alt (<applet>, <area> and <img> elements), label (<optgroup> and <option> elements), prompt (<isindex> element), standby (<object> element), summary (<table> element) and title (core attribute).


  title="Conseil Europ&eacute;en pour la Recherche Nucl&eacute;aire"


Unlike most programming languages, boolean values in HTML are not "true" and "false". Instead, an empty string or a value that matches the attribute name represents true, and the absence of the attribute represents false. The following three examples all represent the true value for the disabled attribute:

<input disabled="disabled">...</input>
<input disabled="">...</input>
<input disabled>...</input>



Dates and times


Space-separated tokens

Comma-separated tokens


Media queries

External links

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.