You are here: Re: Problems with "In-Line Buttons" « HTML « IT news, forums, messages
Re: Problems with "In-Line Buttons"

Posted by Andy Dingley on 10/24/06 09:48

BigDaddyBS wrote:

> Tried it with and without #, but it didn't seem to make any difference.

OK, I give up. That's just too big and ugly a page to try and debug.
Start again with something simpler.

The CSS is _vast_. Far bigger than a page of that complexity deserves.
It's also unreadable -- I can't look at the HTML and get some idea of
the structure you're trying to apply. Why all the multi-class
attributes on small "leaf" elements ? Why all the meaningless class
names like "lib2ed" ? I'm not saying that this isn't right, isn't
valid or that the computers can't work it out, but my poor little brian
certainly can't.

You have a bunch of links which have some common behaviour (they look
like buttons). Are they a logical group? Then group them and stick a
selector on at the group level.

Is each of them subtly different (in colour) ? Then add a per-link
class.

Now use the "behaviour" class to control their behaviour (boxy
buttoness) and the "identity" class to tweak their colours alone. Don't
use the identity to force them into being buttons - you've already done
that. By this simple refactoring you should be able to start reducing
the bulk of your CSS and getting it down to something manageable.

Don't mix selectors with ids from the entire page like #full-page with
classes for mere buttons. Why would you need to do that? Were you
really going to paste the exact button code into a different page and
expect its behaviour to change (you might do, but I suspect not in this
case). If they're "links like buttons", and you want them to behave as
"links like buttons" wherever you put them, then you don't need to
start involving the page's ID in their selectors. Keep it simple. Then
make it even simpler.

Multiple CSS attributes on an element are a powerful tool, but they're
really not needed very often and they can lead to bulky confusing CSS
if you don't keep the CSS neatly structured. Don't duplicate
properties! Don't duplicate chunks of code just because you can, only
duplicate if it's essential to do so. Sooner or later you run into a
situation like this where it might still be correct, but the humans
just can't read it any more.

One trick for simplifying CSS is to validate it with the W3C tool. Then
look at the results tree it gives you, with the equivalent post-cascade
CSS properties that it has extracted from the large pile of source.
Chances are that that's a good basis to start from for a re-worked and
simplified stylesheet.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация