Why Does Codecademy Use IDs Instead Of Classes?

I have taken several other courses and read several advanced books on CSS as well as studying naming conventions like BEM and read many industry blogs like css-tricks.

Across the board, it is said to be best practice to use classes for CSS, and save IDs for JS (of course there are a few exceptions). Classes can be reused, IDs can’t.

But Codecademy is teaching us to use IDs where classes should be used. WHY IS THIS?
This makes me concerned about all the courses in the curriculum. I’d rather spend my time learning best practices instead of having to unlearn them later.

Can someone from Codecademy address this? I’m on the free trial and don’t want to sign up for the year if I don’t hear a good answer about this…

1 Like

Technologies are constantly evolving and best practices along with it. Most every lesson is just designed to get your feet wet. You aren’t actually hurting your development by learning an outdated or different way.

In school they told me I was learning C++ - NOPE! I learned C! Technically it was c++ but it was taught as if the language were C. On my own I went out and learned how to write in a more cpp idiomatic way - but knowing that C was essential.

5 Likes

You aren’t actually hurting your development by learning an outdated or different way.

hmmmm… debatable…

You’ll look back at this and laugh and laugh if you stick with coding.
You are WAY too deep into the SMALL stuff that you shouldn’t sweat.
Will your hard drive get deleted if you use an ID instead of a class?
What will be the actual measured outcome?

You should be worrying about how to use programming to solve problems.

3 Likes

@rootbeer7, you have a good point about this, and I have passed it on to people with more power then myself.

1 Like

Hey @fight_dragons!
Technically you are correct; this isn’t a code breaking error. But I can understand why @rootbeer7 would be worried about this. If the lesson is being taught correctly, then it should be fixed.

5 Likes

Hi @rootbeer7. @fight_dragons makes some excellent points, the fundamental knowledge you are learning is no different whether IDs or classes are used. And there are so many different “industry standards” that change so often you need to be a me to quickly adapt.

The fact that CC uses a different standard to some industries current best practices will help you learn to adapt as the industry moves and grows on.

For other topics we need to be really careful to ensure best practices are used and bad techniques quickly stamped out, but in this case being adaptable will help you more in the long run. Steven has passed the feedback on though so no need to make a bug report.

6 Likes

I am surprised to learn about this, when I did the intensive (paid course, discontinued now), ‘Build website from scratch (2017)’, it was specifically mentioned not to use id if class could do the job. This is what was there in one of the lessons , ‘Classes and IDs’, Since IDs override class and tag styles, they should be used sparingly and only on elements that need to always appear the same.

6 Likes