HTML CSS examples for HTML Global Attribute:id
The id attribute specifies a unique id for an HTML element, its value must be unique within the HTML document.
Value | Description |
---|---|
id | Specifies 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:
<!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>