When using divs when is it best to use a class vs id?
Is it best to use class, on say font variant or elements within the html? Then use id for the structure/containers?
This is something I’ve always been a little uncertain on, any help would be great.
Use
idto identify elements that there will only be a single instance of on a page. For instance, if you have a single navigation bar that you are placing in a specific location, useid='navigation'.Use
classto group elements that all behave a certain way. For instance, if you want your company name to appear in bold in body text, you might use<span class='company'>.