+ 5
I am in confusion on Class and Id attribute.
2 Respuestas
+ 5
A class selector is a name preceded by a full stop “.” and an ID selector is a name preceded by a hash character “#”. The difference between an ID and a class is that an ID can be used to identify one element, whereas a class can be used to identify more than one.
+ 3
Basically they are used to target an element. to target an element using id you need to give id to your element which you want to target id can be any name and in css to target it write "#" character before the name of id like this "#demo". Id must be Unique. class is often used to target element you can give class to your element which you want to target class can be any name. and in css to target it write this "." character followed by the name of the class like this ".demo".