+ 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. â
8 Answers
+ 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.
+ 5
elements means HTML elements.
all those tags in html are also known as elements.
+ 4
no problem, Shane
+ 2
This is one element
https://mdn.mozillademos.org/files/7659/anatomy-of-an-html-element.png
+ 1
Thank you so much ,
but now i dont understand âyou cannot give multiple elements same idâ
what do you mean by elements
+ 1
ohhhhhh!!! okay wow i feel like something just clicked in my brain!! THANKYOU SO MUCH !! :)
+ 1
why would you ever use an I'd over a class though??
0
thank you so much !!