Difference between #id and div#id

后端 未结 9 1793
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-22 04:52

I am new to css. Can someone help me in differentiating \"#test\" and \"div#test\"?

9条回答
  •  既然无缘
    2020-12-22 05:33

    You really ought not to qualify an ID with a tagname per the MDN, as follows:

    Don’t qualify ID rules with tag names or classes

    If a rule has an ID selector as its key selector, don’t add the tag name to the rule. Since IDs are unique, adding a tag name would slow down the matching process needlessly

提交回复
热议问题