HTML ID

Being BENI24



HTML ID 

In HTML "ID" is an attribute that can be applied to an HTML element to uniquely identify that element within the web page.

The ID attribute is used for a variety of purposes, including JavaScript scripting, CSS styling, and linking within the same page using fragment identifiers.

Syntax:

<element id="unique ID">content</element>


Example:

 
  <!DOCTYPE html>
  <html>
  <head>
  <style>
  .header {
    background-colorlightgreen;
    colorblack;
    padding: 20px;
    text-align: center;
  }
  </style>
  </head>
  <body>
  <h1>HTML id</h1>
  <p> HTML "ID" is an attribute that can be applied<p>
  <h2 id="header">My Header Page</h2>
  </body>
  </html>



Output:






More topic in HTML

Our website uses cookies to enhance your experience. Learn More
Accept !

GocourseAI

close
send