Cascading style sheets use “id” or “class”

后端 未结 15 2517
夕颜
夕颜 2020-12-05 16:11

when styling specific html elements, i tend to always use the class attribute. the css code looks cleaner imo.

why do both exist which one should you use and when ?<

15条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 16:44

    I use id if it's a single element, class if it applies to more than one

提交回复
热议问题