CSS & HTML Tutorial #2: Difference between Id and Class Selectors

preview_player
Показать описание
In this tutorial we cover the difference between the id and class CSS selectors. Id selectors being used to reference single html elements and class selectors being used to represent multiple html elements
Рекомендации по теме
Комментарии
Автор

great tutorial! it was clear and simple to follow along. Thanks!

hedleylyf
Автор

The way I understand it is that ID's can only be referenced once by a browser per page, where as classes can be referenced multiple times. The reason is so that a url can reference the # element and scroll to it upon page load. For example:

www.youtube.com#comments - It obviously would look like this its just an example but
If you did that the page would scroll down or jump to the comments section and it needs the ID to be unambiguous to find the correct location on the page. As a beginner (Which I am) I just use classes instead of IDs as I don't require such functionality and it makes my code easier to understand.

theexcelkid
Автор

Nice tutorial man, you deserve more views

AversiePzz
Автор

Hi there.. what editor are you using? Thanks I learned something

MiaDevlin
Автор

Bad tutorial... The title says "Difference between Id and Class Selectors", but he doesn't even say the difference once. All he says is how you put on a border, background-color, etc.

MultiKJamK
Автор

thank you soo much!! u saved my life :P

nastjacedilnik
Автор

so why not always use class then? What's the point of an ID?

wardancer