Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4
ID is for one element only; class can be used across many. For instance, in your CSS you could put all your paragraphs in the class #myParagraphs and set their font family to Arial and colour to black, but then also give one of them the id .importantParagraph and give it the font colour red. The .myParagraph id is a more specific way of selecting an element than the class #myParagraphs, so it would override it and the font colour would be red BUT the font family would still be arial because it belongs to the #myParagraphs class. EDIT I put it together in code here: https://code.sololearn.com/W9yzQaoMhCwx
13th May 2019, 9:46 AM
Rincewind
Rincewind - avatar