HTML id attribute
Id attribute defines the unique identifier for the HTML elements. It is used to approach specific parts in a page.
<p>The <dfn id="ww"><abbr title="World Wide Web">WWW</abbr></dfn> is an information space where documents and other web resources are identified by Uniform Resource Locators (URLs), interlinked by hypertext links, and can be accessed via the Internet.</p>
The <a href="#ww"><dfn>WWW</dfn></a> has been central to the development of the Information Age and is the primary tool billions of people use to interact on the Internet.
</>
The WWW is an information space where documents and other web resources are identified by Uniform Resource Locators (URLs), interlinked by hypertext links, and can be accessed via the Internet.
The WWW has been central to the development of the Information Age and is the primary tool billions of people use to interact on the Internet.Attribute values
All possible values of id attributeThe value of this attribute is plain text.
The value of id attribute should be unique (no duplicate value) in a page.
At least one character should be present in the value attribute.
The value should not have spaces between words (id=learn html). It is wrong.
The id attribute is used to approach specific parts in a page. It may also be used to style specific elements using CSS properties.
id attribute can be used in the scripting language to manipulate different elements.
Next Previous
Was this article helpful?