Sent by Chris Heilmann on 14 September 2004 10:10
> Here is some CSS a coworker claims to be superior:
>
> http://www.mentoru.com/site/FRANNY/css_plc.css
>
> and here is some CSS I have presented as being better, and that he has
> publicly called "cryptic" and "fragile" and "a maintenance headache":
>
> http://www.blackcoil.com/css/blackcoil01.css
>
>
> WTF? Is my CSS bad?
Well, they both validate, that is good.
Personally I consider the repetition of the same definition in his CSS
superfluous, as those can be grouped in one definition with loads of
selectors. Also inheritance can help with the :hover definitions.
With yours he has a point when it comes to maintenance, IMHO it is better
to give each definition an own line.
#navContact {
height: 100px;
width: 81px;
float: left;
background: url(../media/navContactOff.gif) no-repeat;
}
instead of
#navContact { height: 100px; width: 81px; float: left; background:
url(../media/navContactOff.gif) no-repeat; }
Also you failed to define background-colours to fall back on should the
images not be available.
Generally yours is more readable, as it has ID selectors that make sense
without seeing the markup (but please don't call a class "RED"), his is
rather cryptic and the markup must suffer from classitis.
Both need cleaning.
For my developers here I defined some loose standards as to how to
approach CSS, they may be of help for you:
http://www.onlinetools.org/articles/cssguides.html
--
Chris Heilmann
The mighty pen: http://icant.co.uk/
Learn to let go! http://ltlg.icant.co.uk
Binaries: http://www.onlinetools.org/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/