Difference between class and id in css

ID is useful when you want one instance only in the whole HTML page. It can be useful when you use JavaScript and you want to target a specific part; by example "go to top". It is widely used for forum and is useful. Both classes and IDs can be managed via CSS. But because you can repeat classes to get less CSS code.
 
Back
Top