+ 5

I am in confusion on Class and Id attribute.

10th Apr 2020, 6:30 AM
RK KESHRI
RK KESHRI - avatar
2 Answers
+ 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.
10th Apr 2020, 6:53 AM
Mahmudul Hasan
Mahmudul Hasan - avatar
+ 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".
11th Apr 2020, 10:28 AM
Muhammad Awwab Khan
Muhammad Awwab Khan - avatar