Really great developers in the past few years are claiming we should not use classes, and another half feel we should not use ID's in our selectors. Both sides are very knowledgeable, lots of experience and a big name in the industry. But neither ever give an explanation as to why unfortunately...
The Details
These days I see it more often than not, whenever someone brings up common mistakes or issues in CSS development, a lot of well known and proven great web developers are all claiming different opinions on whether or not one should continue using Classes, or should not bother with ID's anymore. Both sides are very knowledgeable and really know what they are talking about, and thoroughly proven themselves in the industry.
Its a bit confusing to follow, and decide which is right and why we should choose one or the other.
I dont need to give resources here, as there are tons. Just do a quick search on both. Google:
"Dont use CSS Classes"
as well as
"Dont use CSS IDs"
The results will contradict each other, by both arguing the same reasons why we shouldn't use one or another..
Their Stand
When I am not coding myself, I pass time by following professional designers and developers blogs, magazines and websites, just to try to stay in touch with the latest standards, and things to look forward too.
But this is one issue I stumble upon constantly.
One person claims how it is not right to continue using Classes, as they feel they are inferior to ID's. Another person or group will say the complete opposite. Others have just learned coding through only using one or the other, and have been taught that one should only use one or the other.
My Stand
Others, like I, believe that we should continue using both for their correct purpose that they have been maintained for since the beginning. Use classes for Selectors that will be used over and over again. Use ID's for selectors that only need properties to be declared to only one selection.
I still think we should continue using both, and I feel it would be unwise to drop the use of one or the other...
The Question
What are your thoughts on this issue? Should we continue using both as they have always been used? or should we drop one or the other in favor of a more useful selection?
If so why? Any resources to help justify your claims? and if you don't base your views on resources, but instead personal preference from long term experience, give detailed reason to back your stand.
I want to know if there is a REAL reason why one or the other is either superior or inferior. Why should one ever even consider this?
At first I figured it was a matter of opinion, and personal preference, but now the more and more I see this issue, the more and more these people are trying to make people follow the methods they believe is right. But all in all, I haven't found one actual explanation as to why..
* I would prefer if you answer, please give good reason, and explain why you feel that way.
I just don't get it, why would people feel this way? there is really no good reason to drop one or the other that I can find.
Could using both, or one instead of the other actually effect your development? Is it possible one or the other may be deprecated in the near future, or a good reason why we should start moving towards deprecation of one?
No matter how much I look into it I cant understand this argument. Because as I said, both sides argue the same reasons and contradict each other.
Which is why I am turning to you guys here at WebDeveloper.com forum, to get a little discussion going on this, to hear everyone's opinion, and help me to better understand why people feel this way. If anyone can help to make me understand this or start to consider it in my own development, its a group discussion with other developers or the unlikely case that W3C deprecates one of them.
Please share your thoughts.
Thank you for your time as well.
Last edited by CDev; 09-24-2012 at 08:51 AM.
Reason: typo
That article strikes me as complete nonsense. Avoiding classes in favor of context selectors (e.g. child selectors), hmmm, I don't think so. Kind of an interesting point of view, but simply wrong.
-What (font) color will this element have?
(It will be red of course! )
That's why the issue in question, is a complete nonsense.
You will use selectors according to their strength, and only as strong as necessary and of course only when required to override some previously defined/ inherited style.
Bookmarks