why use id's & class's in html why not just one?

后端 未结 4 413
春和景丽
春和景丽 2020-12-22 11:17

i understand what there is a difference between id\'s and class\'s - ids and ment to be given to a unique item, and class\'s and like tags, they can be given to multiple ite

4条回答
  •  星月不相逢
    2020-12-22 12:00

    Imagine if you had a load of buttons that looked the same on the page. Would you want to repeat yourself numerous times in your CSS? Or use a class and write it once.

    This is applicable in any case of the same styling on different elements.

提交回复
热议问题