HTML Id Attributes
In this article, we will know how to identify the specific HTML element by its id using HTML id Attribute, along with understanding its implementation through the examples.
Note: This is a global attribute, it can be used in all the tags.
Example 1: In this example, we simply style the element with id “geeks”.
Example 2: In this example, we are adding the styling properties to the specific id attribute value by fetching its id value.
Note: In HTML5, id attributes can be used by any HTML tag but in HTML 4.01 there are some restriction to use id attributes. It can not be used by <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title> tag. In HTML4.01 id can not start with number.
- Google Chrome
- Edge 12 and above
- Firefox 32 and above
- Internet Explorer