views:

67

answers:

2

I'm having a CSS issue that only occurs in Safari and Chrome. I have a set of styles for links in the content of a site that I'm working on. Visited links should appear a different colour and with a dotted bottom border. In Safari and Chrome the visited links lack the bottom border though, although all other styles are applied. Does anyone know of a bug in the webkit engine that causes this or have I made some stupid mistake? Code below:

#content a:link {
    color: #b32951;
    text-decoration: none;
}
#content a:visited {
    color: #353535;
    border-bottom: 1px dotted;
    text-decoration: none;
}
#content a:hover, #content a:active {
    color: #b32951;
    background: #E6B5AF;
}
A: 

Try giving the border-bottom a color:

border-bottom: 1px dotted #000;
hookedonwinter
I did try that and it didn't make a difference: the border displays in all browsers except for Safari and Chrome. AFAIK the CSS spec doesn't mandate that a colour be declared for a border. If one isn't declared the border inherits the colour of the text.
Jeremy
+1  A: 

This is not a bug, it's a feature. It was possible for a site to sniff the browser history through :visited-styles. You will only be able to style :visited in a way that doesn't affect the metrics of the link, which adding a border would. The same feature is coming to Fx4. (Source, MDC)

Daniel
Many thanks for this. I've just set all links in the content to have dotted bottom borders to get over this issue. That's an interesting change and one which doesn't seem to be too well known as of yet.
Jeremy