Classes and IDs

suggest change


Classes and IDs make referencing HTML elements from scripts and stylesheets easier. The class attribute can be used on one or more tags and is used by CSS for styling. IDs however are intended to refer to a single element, meaning the same ID should never be used twice. IDs are generally used with JavaScript and internal document links, and are discouraged in CSS. This topic contains helpful explanations and examples regarding proper usage of class and ID attributes in HTML.



Parameter| Details|

|–––––|––––| | class | Indicates the Class of the element (non-unique) | | id | Indicates the ID of the element (unique in the same context) |


Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents