ID vs CLASS in CSS. Please explain in detail with example

后端 未结 8 1687
不思量自难忘°
不思量自难忘° 2021-01-29 11:46

I have heard that ID is unique and can only be used once in a page, but its working fine when used over multiple times on a page. Please let me know the purpose of ID and hows i

8条回答
  •  花落未央
    2021-01-29 11:59

    In CSS terms, ID's are faster to find than classes.

    You should use classes for things that are to be re-used.

    EG:

    @CSS
    
    .displayNone
    {
        display:none;
    }
    

提交回复
热议问题