I am learning HTML. Can someone please tell me what is the difference between class and id and when to use one over the other? They seem to do the same thing
<!DOCTYPE HTML> <html> <head> <style> #mycolor1 {color: red;} .mycolor2 {color: red;} </style> </head> <body> <div id="mycolor1"> hello world </div> <div class="mycolor2"> hello world </div> </body> </html>