Classes and IDssuggest change
- class=“class1 class2 class3”
|–––––|––––| | class | Indicates the Class of the element (non-unique) | | id | Indicates the ID of the element (unique in the same context) |
idare global attributes, and may therefore be assigned to any HTML element.
- Class names must begin with a letter (A-Z or a-z) and can be followed by letters, digits , hyphens and underscores.
HTML5, the class and id attributes can be used on any element. In HTML 4.0.1, they were off-limits to the
- An element can have one or more classes. Classes are separated by spaces and cannot contain spaces themselves.
- An element can have only one ID and it must be unique within its context (i.e. a webpage). IDs also cannot contain spaces themselves.