Jump to content

[SOLVED] Force a browser to use CSS pseudo class


phil88

Recommended Posts

I'm having a issue with IE7 and CSS. I've made a site that uses AJAX to retrieve the content needed for each page without the browser needing to navigate away. When a link is clicked and the javascript does its thing and stops the browser navigating away, IE7 doesn't return the link to a:link or a:visited styles- instead, it 'gets stuck' on a:active. So, once a link is clicked, it's stuck with a red border underlining it when it should revert back to having no border - the a:link and a:visited states.

 

Is there a way to force a browser to use a pseudo class?

 

This is the CSS I'm using for the links;

#navLinks a:link,
#navLinks a:visited{
color: black;
text-decoration: none;
font-size: 24px;
font-family: Verdana;
font-weight: 500;
margin-right: 10px;
}
#navLinks a:active{
border-bottom: 8px solid #8f2c2c;
}
#navLinks a:hover{
border-bottom: 8px solid #6aaaaa;
}

Link to comment
Share on other sites

Still no luck. I was sceptical of your second suggest because it's handling all the pseudo classes fine (including :hover), it's just not reverting to using :link or :visited when the link is no longer :active, but I tried it anyway.

 

I've uploaded what I have so far, so you can see exactly what I mean. You can view it here. Click on the main navigation links in the top right of the page using IE7 to see what I mean. Unlike every other browser, IE7 keeps each link :active (red underline) even when the javascript is finished.

Link to comment
Share on other sites

Thanks for the info.

 

I managed to do a bit of a botched fix. Because the only thing that changes from :active to :visited is the border, I just used javascript to set the CSS to border:0; after the AJAX has generated the page. Not ideal, but it works.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.