@xckpd7:
Not quite. Don't try to go dogma. It's not that locational styles are
*per se* frowned upon. There is in most cases a very good reason for
this. The more you code location-dependent, the less you can reuse *in
general*; and the more you have to recode *in general*. "In general"
meaning that it happens and has happend SO many times with location-
dependent styles that you can start so see a pattern, a reason as for
why the suckiness of code increases over time. And location dependence
plays a role in it.
For beginners, I would definitely recommend to go with a dogma of "no
location dependence" for a while to get a sense of what it means to
code OOCSS-style. But in the end, you have competing goals, and you
have to compromise. Applying a set of rules without thinking about it
will not always provide the best result. You are asking for a "best
practice", but be aware that the best practice is the best practice
*in general*. Yes, your code will be a lot better if you code OOCSS,
but once you have a firm grip on the principles and a few OOCSS-style
websites under your belt, you won't need a brains-off-dogma anymore,
because it was and is only there so that you don't have to do the
thinking *from the very start*; it's not there to allow you to shut
off your brain from now on forward.
Above all, OOCSS shows you that a) CSS doesn't suck, and b) a
practical way out of the general code problems you run into when you
code traditionally. When you code it for a while, you will run into
cases where it's not obvious which choice is best and the call is on
you. These types of questions somehow always seem to end up on this
board, and they are framed in a way that makes OOCSS responsible for
solving the problem in a super amazing way, and if it doesn't, it's
broken. OOCSS won't allow you to stop thinking, it will help you to
think better! It shows you general weaknesses in your code and how to
solve them. But you will always find situations where coding in a very
strict way will not be the best choice, because that's the reality we
live in as frontend architects. Opposing goals. I cannot stress this
enough. If you found a use case where coding in a very strict way is
not practical for you, it doesn't mean OOCSS sucks, it means that you
have to choose which way to go in a situation where both roads bring
advantages and disadvantages, and there is no clear "yes" or "no".
After coding OOCSS you will be more EXPERIENCED and hopefully see both
paths clearly, and you can take all factors into consideration when
making the call.
So, xckpd7, don't take it as dogma. Coding OOCSS will improve your
code. It won't necessarily be the FINAL stop on the road to the most
perfect and elegant code ever, but it's a very important stop on
making you a better frontend architect.
As Nathan said, we are moving sort of off-topic and into a theoretical
area. That might not actually be useful to the original question. As
Ethan said, I would also appreciate more context to constructively
solve the issue at hand.
Cheers,
Erik