views:

216

answers:

4

when i click on anchor tag - a dotted border come around my anchor text. the is is coming in IE7,IE8 and firefox. I have used.

a{ outline:none; }

this works as expected.But i need to clear the cache of my browser. Unless and until i don't clear the cache in my browser that dotted line appears around my anchor text.

Could anybody please tell me why always I am required to clear cache everytime to make outline property work. Is there any solution that without clearing the cache that dotted line will disappear.

+1  A: 

You may need to add the a:visited pseudo-class to in your CSS:

a:visited { outline: none; }

The a:visited style should inherit from the a class, but some older browsers like IE6 do not follow this rule (Source). To ensure correct style compatibility with older browsers, it is recommended to define the a:visited pseudo-class.

Daniel Vassallo
is that necessary? a:visited will inherit the outline:none from a
pixeltocode
@pixeltocode: I'm not sure if all the browsers inherit from `a` as they should. I'll try some tests... However the problem of the OP seems linked to `a:visited`.
Daniel Vassallo
@pixeltocode: Apparently IE6 doesn't inherit correctly in this case. This is alsoo mentioned in this SitePoint forum post: http://www.sitepoint.com/forums/showthread.php?p=2308104#post2308104
Daniel Vassallo
I had also tried this. But still i need to clear cache to get this working.
shruti
+1  A: 

try using a reset CSS like this

pixeltocode
+1 Yahoo (YUI) have a good reset stylesheet (as do many others), but I also tend to stick with Eric Meyer.
CJM
A: 

The best way to get rid of this is to use a:visited and/or a:active like Daniel Vassallo anwered.

This should fix the problem and still gives visual feedback to users who navigate through all elements with TAB.

MysticEarth
A: 

i have used..

a:link, a:visited, a:hover, a:active{ outline:none !important; -moz-outline:none; }

but still i need to clear cache everytime to make it working.

shruti