1

I was asking this cause whenever I see an HTML tutorial I always see the person use a class for an element when they only have one of the element. Wouldn't it be easier to use an id instead, or is it better to use a class?

1 Answers1

0

If the site is in-development, this may mean that they plan to use more of that same item.

There isn’t really a difference otherwise, a class can be applied to multiple items, but an ID can only be applied to one item.

I use classes as a matter of personal preference, unless I plan to use JS with that (single) element, then it is easier for me to use an ID.

iPhoenix
  • 719
  • 7
  • 20