CSS——类和ID选择器的区别

1.相同点,可以应用在任何元素。

2.不同点,ID选择器只能在元素里只能分别引用,不能同时引用。

如:

<style type="text/css">
.stress{(类选择器)
color:red;
}
.bigsize{
font-size:25px;
}
#stressid{(ID选择器)
color:red;
}
#bigsizeid{
font-size:25px;
}
</style>

类选择器:<span class="stress bigsize">  可以这样引用。

ID选择器:<span id="stressid bigsizeid">不能这样引用。

原文地址:https://www.cnblogs.com/carrier-sisi/p/7594477.html