Class or ID on Body Tag

前端 未结 6 631
抹茶落季
抹茶落季 2021-01-01 11:40

I\'ve been applying an ID to the body tag of my HTML documents lately to allow greater CSS control (#9). Recently the though occurred to me that I could do exactly the same

6条回答
  •  迷失自我
    2021-01-01 11:48

    You can (read: should) only use the id on the body tag.

    ID = single use per page

    Class = multiple uses

    1 Body tag = 1 id tag. This can be the same on different pages. Essentially, using the class tag is probably overkill for this purpose.

提交回复
热议问题