当前位置:网站首页>The difference between ID selector and class selector

The difference between ID selector and class selector

2022-07-05 19:38:00 Try some fresh food with a child

1、ID Selectors
ID Selector use # Are identified , Follow closely the next year ID name
grammar :
ID Selectors
id name { Property name 1: Property value 1; Property name 2: Property value 2; Property name 3; Property value 3;}
label
< p id=“id name ”>< /p>
Elemental ID Value is unique , It can only correspond to one element in the document .
Usage is basically the same as class selector
2、ID The difference between a selector and a class selector
w3c The standard stipulates , In the same page content , It is not allowed to have the same name id The object appears , But the same name is allowed class
Class selectors (class) It's like a person's name ,, It can be used multiple times
ID Selector is like a person's ID number , All China is the only , Don't repeat

原网站

版权声明
本文为[Try some fresh food with a child]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051935562121.html