TJKDesign: Home Page
Creative Commons License
This work is licensed under a
Creative Commons License.

If you've found this beneficial, consider making a donation through Paypal

Guild of Accessible Web Designers Logo
Valid XHTML 1.0!
Section 508
Web Standards
Tables-less Layout
Frames: a solution or a problem?
XML Feed
NN4.7 Safe!

divaHTML logo
Bookmark this article at these sites:

A spacer (shim) can be a useful tool for CSS-P designers.

I'm sure that with a title like that I'd get the CSS-P purists' attention. For most of them, such things should not exist. They call them names; the first one that comes to mind is... "junk".

But when it comes to support NN4, one may need to forget about semantic and other esoteric considerations and go for structural hacks that work! For example, using spacers may help to deal with anchors that are used as a horizontal set of links.

Such sets of links call for a solution to "space out" the anchors from each other, and - because one cannot really rely on padding or margin - 99.90% of the time designers end up using a bunch of " " (Non-Breaking SPaces).

This "fix" sure makes the page look better but, IMO, has 2 flaws:

  • it creates an "accessibility" issue,
  • it leaves the same "footprint" with every single browser.

I think Spacers are the perfect alternative to this "junk" markup because they fix both issues at once. If one inserts a transparent image between links, one can then space out the anchors by setting the images' width to an appropriate size through the markup and in the meantime resets these values through the style sheet [for example #menu img {width:0}].

Note that spacers are also very useful to deal with background issues in NN4, to nicely clear FLOATs (read this) and to trick browsers that are "min-height" challenged (as done on this page).

Et voilà!