[thelist] Removing link colors

Andrew Clover and-evolt at doxdesk.com
Mon Mar 28 05:25:29 CST 2005


Chris Kavanagh wrote:

> I'd like to make the links on my page have no special colour.

Has no-one mentioned 'inherit' yet? This is the normal CSS2 way to make 
a property take its parent's computed value:

   a:link {
     text-decoration: none;
     color: inherit;
   }

The slight snag - natch - is that this doesn't work on IE. However you 
can use a JScript expression hack to duplicate the behaviour:

   a:link {
     text-decoration: none;
     color: inherit;
     color: expression(this.parentNode.currentStyle.color);
   }

If you want to validate the CSS, you could hide the 'expression' rule in 
a separate style in a conditional comment, or something, I suppose.

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/


More information about the thelist mailing list