HTML id Attribute
- The HTML id attribute is used to uniquely identify an element within an HTML document.
Syntax:
id=“id-name”
Note: You cannot have more than one element with the same id in an HTML document.
Using the id Attribute
- To create a id; write a period (#), followed by a class id. Then, define the CSS properties within curly braces {}
Example:
🚀 Try it yourself! Click the button below to run the code and see the output in action.
HTML Code
Output
Output:
Designwithrehana
If you are interested in frontend development, you are at the right place.
Important Note: Want to download the full HTML course as a PDF? Click here to save it locally!