Tutorial by Examples

Classes are identifiers for the elements that they are assigned to. Use the class attribute to assign a class to an element. <div class="example-class"></div> To assign multiple classes to an element, separate the class names with spaces. <div class="class1 class2&...
The ID attribute of an element is an identifier which must be unique in the whole document. Its purpose is to uniquely identify the element when linking (using an anchor), scripting, or styling (with CSS). <div id="example-id"></div> You should not have two elements with th...
Having more than one element with the same ID is a hard to troubleshoot problem. The HTML parser will usually try to render the page in any case. Usually no error occurs. But the pace could end up in a mis-behaving web page. In this example: <div id="aDiv">a</div> <div id...
For an ID 5 The only restrictions on the value of an id are: it must be unique in the document it must not contain any space characters it must contain at least one character So the value can be all digits, just one digit, just punctuation characters, include special characters, whatever. ...

Page 1 of 1