Why use id for header and footer and class for the rest (left and right) (Lesson: Build a resume)


#1

I think I understand the difference between using id's and classes, id's being more specific. But can you please explain why, in the lesson Built a resume, the header and footer div's are supposed to have the ID selector and the left and right div's CLASS?


#2

If where to build that from scratch, i would have given left and right a id, not a class.

Why use class? Because the creator of the course decided so. The great thing of being finished with the course: You can give your own twist to things


#3

Thank you!
But since I'm still learning, I'm trying to understand and find the 'why' of things. The difference between using id's and classes is still a bit confusing to me, so please tell me why you, stetim94, would use ID instead of class for left and right?


#4

Very good, trying to understand why is very important. To fully understand the difference between class and id, you should understand the point system css uses in case of conflict, which you can find here. It is a bit complicated. Take your time reading it.

Besides the point system, i would use id instead of classes because these 4 div elements are the backbone of your layout. They are rather important, and they are unique. (id names have to be unique)


#5

Thanks again for your quick reply. While searching to understand the difference I had already come upon that great smashingmagazine site. It's become my second favorite site to learn about coding, after Codecademy :slight_smile:


#6

smashingmagazine has some must read articles, including about float. You're welcome


#7

Yeah, I read that one too. Just a bit more background information.