Global id Attribute - HTML CSS HTML Global Attribute

HTML CSS examples for HTML Global Attribute:id

Description

The id attribute specifies a unique id for an HTML element, its value must be unique within the HTML document.

Attribute Values

Value Description
idSpecifies a unique id for the element.

id value Must contain at least one character and Must not contain any space characters

In HTML, all values are case-insensitive

The following code shows how to Use the id attribute to link to an element with a specified id within a page:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
<h2><a id="top">There is a link at the bottom of the page!</a></h2>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<p>This is a test. This is a test. This is a test.</p>
<a href="#top">Go to top</a>
</body><!--from  w  ww .j  a  va 2 s.c o m-->
</html>

Related Tutorials