I am often presented with the following problem:
I have markup which resembles the following:
<body>
<div id="wrapper">
<div id="header"><a href="/">home</a>
</div>
<div id="left-column">
<ul>
<li><a href="/1">one</a></li>
<li><a href="/2">two</a></li>
</ul>
</div>
<div id="main-content">
<p><a href="#">some link</a> lorem ipsum</p>
</div>
</div>
</body>
Imagine this on a big scale, with many different navigation items, paragraphs and advanced stuff in general.
I'm trying to follow the OOCSS and Modular CSS principles, avoid location-based styling, but in many cases the CMS just is not flexible enough to add classes everywhere.
So in order to style all links in main-content with a border I end up doing :
a {border:1px solid #000;}
But then somehow all my links in the left-column
end up with borders. Then I have to go and over-write:
#left-column a {border:0;}
And this is the beginning of chaos. For every change you do in a
you have to go add reset styles to all 'exceptions'.
Then I attempt
#main-content a {border....}
But that's even worse. Why? Because the id is a powerful selector and will over-write links inside #main-content that normally should not have a border applied.
Any suggestions to do efficient link styling without resets? If CSS "Scope" is not yet a Release candidate module, which tools does CSS natively gives us to work out this problem? Would order of appearance of rules help for example?