HTML Id Attribute | 99codes

HTML Id Attribute


The id property is an extraordinary identifier which is utilized to indicate the report. It is utilized by CSS and JavaScript to play out a specific errand for a one of a kind component. In CSS, the id trait is utilized utilizing # image pursued by id.

Id Attribute

Example -


 

Output -


Id Attribute



 
 Browsers that support Id attribute:

1. Google Chrome
2. Mozilla
3. Internet Explorer
4. Safari
5. Opera 

Note :-

In HTML5, id traits can be utilized by any HTML tag yet in HTML 4.01 there are some confinement to utilize id qualities. It can not be utilized by <base>, <head>, <html>, <meta>, <param>, <script>, <style>, and <title> tag. In HTML4.01 id can not begin with number.

Distinction among id and class:


1. HTML page contains numerous component with same class however id is one of a kind,   just single id exist in single page.

2. HTML class use '.' character before the name of the class while id use '#' character before the name of the in CSS.


Example -



 

Output -


Id Attribute

Use Of Id Attribute in JavaScript -

In JavaScript, the id credit is utilized to control the content, on the off chance that you need to make changes on an exact component in your content, at that point you can utilize id property.

Example -



Output -


Id Attribute











HTML Id Attribute | 99codes HTML Id Attribute | 99codes Reviewed by Arup Roy on May 19, 2019 Rating: 5

No comments:

Powered by Blogger.