+ 1

what is the difference between css ID & CLASS selector?

please experts explain this.its important for all who are new.this section should have those explaining .thanks everyone for being in solo learn.

18th May 2017, 1:09 PM
Redoy Islam
Redoy Islam - avatar
10 odpowiedzi
+ 5
in css / html every element has different id (unique) while multiple elements can have same class. ex in html <div id="uid"></div> <div class="cls"></div> in css we use id as #id{} ex #uid{} we use class as .class{} ex .cls{} more difference​ http://stackoverflow.com/questions/12889362/difference-between-id-and-class-in-css-and-when-to-use-it
18th May 2017, 1:15 PM
MR Programmer
MR Programmer - avatar
+ 2
any element ( img , div ,p ) can have id but its should not be same. it will work but you shouldn't​ do it.
18th May 2017, 1:38 PM
MR Programmer
MR Programmer - avatar
+ 1
so for div only can use id again and again in same page but for others cant.is it?bcs i have tried div in one page with same id again and again but its working so i'm confused
18th May 2017, 1:36 PM
Redoy Islam
Redoy Islam - avatar
0
id is unique each id can only appear in a HTML file once, whereas class can be repeated in HTML file.
18th May 2017, 1:15 PM
Calviղ
Calviղ - avatar
0
Id is always unique class can be same for many inheritance goes like this element-class-id
25th May 2017, 12:00 PM
Jitender K Yadav
Jitender K Yadav - avatar
0
div allows use of id
25th May 2017, 12:01 PM
Jitender K Yadav
Jitender K Yadav - avatar
0
Hi
19th Jun 2017, 5:11 AM
Amaduddin Ibrahimi
Amaduddin Ibrahimi - avatar
0
Fill in the blanks to give yellow background color to the element with id="intro", and black text color to the class="mytext": #intro { background-color: yellow; } { color: black; }
6th Jul 2017, 9:54 PM
Akinsanya AbdulRazaq
Akinsanya AbdulRazaq - avatar
0
#intro { background-color: yellow; } .mytext { color: black; }
14th Sep 2017, 4:15 PM
Nazmul Sarker
Nazmul Sarker - avatar
0
Nazmul is right
4th Feb 2019, 1:32 AM
Romanus Ogbuzuru