Mobile Friendly Website


Doing it with style

CSS DEMOSNicholls active/focus image replacement

Date : 22nd January 2006

For all modern browsers

Normal Phark Image Replacement technique with dotted border error in Firefox
Revised technique to restyle the dotted border using JUST CSS


There has been much discussion recently on the best way to remove the active/focus dotted borders when using the Phark Image Replacement technique. The problem arises in Firefox, which insists on making the border stretch around the 'off-screen' text. If you are using Firefox, click the first image and you will see what I mean.

The border shoots off the screen to the left causing an unsightly line of dots.

The current methods get rid of the border altogether in Firefox but leave it in place in Internet Explorer. Not really a cross browser answer with one method even failing css validation.

In my technique the dotted border is removed in ALL browsers and replaced with a css styled alternative and, what is more, uses validating css and NO javascript (direct or indirect).

Click on the second image and see that the dotted border is gone and replaced by a border color change from black to red. This, of course, can be styled as you wish to fit in with the look of your site.

This technique does require an extra element around the text but I don't think this is too much for a validating css answer.

The embeded css shows how this is achieved and uses the nicholls DOTTED LINE REPLACEMENT technique which reduces the actual link to zero size and styles the inner element instead. The CSS is commented where necessary to explain the styling requirements.

Because of all the time and effort spent in producing this demonstration I would ask that you respect my copyright.

  1. If you are using this on a personal web site then please retain the copyright comment in the stylesheet.
    A support donation is now required for this demonstration.
  2. If you are using this on a commercial web site, or as a paying job for a client, then please email me asking for permission - stu{at} and again a support donation is required.
  3. If you are having problems integrating any of my demonstrations into your website then I now offer a service to fault find and correct any errors that you may have introduced. Please email me for more information.


Your donations keep CSS PLAY running.
If your donation is for the use of a demo then please email me with the demo url after making your donation.


Facebook Twitter rss feed Facebook Fan Page