+ 1

ID selectors can only be used once per page

I don’t understand this? So I can’t color text from multiple IDs? I guess? I don’t know how to phrase my question. I can only color text if it’s under a class? Multiple times? “Class selectors work in a similar way. The major difference is that IDs can only be applied once per page, while classes can be used as many times on a page as needed. “

17th Sep 2018, 1:54 AM
Shane
Shane  - avatar
8 Antworten
+ 5
if you want to apply same css to multiple html elements, use class. just define a class in css, write all stylings and then give that class to all elements you want to style same. but id will be always unique. you can not give multiple elements same id. giving same id to multiple elements will make difficulty in JavaScript part.
17th Sep 2018, 1:59 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 5
elements means HTML elements. all those tags in html are also known as elements.
17th Sep 2018, 2:04 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 4
no problem, Shane
17th Sep 2018, 2:07 AM
Raj Chhatrala
Raj Chhatrala - avatar
17th Sep 2018, 3:01 AM
CalviŐČ
CalviŐČ - avatar
+ 1
Thank you so much , but now i dont understand “you cannot give multiple elements same id” what do you mean by elements
17th Sep 2018, 2:03 AM
Shane
Shane  - avatar
+ 1
ohhhhhh!!! okay wow i feel like something just clicked in my brain!! THANKYOU SO MUCH !! :)
17th Sep 2018, 2:06 AM
Shane
Shane  - avatar
+ 1
why would you ever use an I'd over a class though??
13th Oct 2018, 7:31 PM
Katie Howard
Katie Howard - avatar
0
thank you so much !!
17th Sep 2018, 2:17 PM
Shane
Shane  - avatar