This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / 那位大侠能给我讲讲CSS里class=和id=的区别?我看了一些书,发现他们都没有讲明白,从举的例子看两者可以通用,对吗?
-eglington(eglington);
2001-3-28
(#38054@0)
-
class is used for CSS, which is the name of that style; id is used for Javascript, to identify the object in scripts.
-bloor(bloor);
2001-3-28
(#38056@0)
-
You can't use them interchange. But you may also want to have a look at the name attribute, which is almost the same with id. Usually, I use both the ID and NAME, and set them to the same value.
-bloor(bloor);
2001-3-28
(#38057@0)
-
电话里谈。请email给我你的电话
-eglington(eglington);
2001-3-28
(#38058@0)
-
ID is not the same with CLASS.The ID and the CLASS in CSS are closely related with the ID and the CLASS in a document language, such as HTML, respectively. I think that the clue for understanding CSS ID and CSS CLASS is to understand the differences between ID and CLASS in a document language first. The key difference between ID and CLASS in a document language is that ID must be unique in a document, but CLASS may not be.
-old(HH);
2001-4-2
{396}
(#39619@0)