phil88 Posted March 28, 2009 Share Posted March 28, 2009 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; } Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/ Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 Try: <!--[if lt IE 8]> <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script> <![endif]--> Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796024 Share on other sites More sharing options...
phil88 Posted March 29, 2009 Author Share Posted March 29, 2009 That didn't make any difference unfortunately. Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796028 Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 http://www.xs4all.nl/~peterned/csshover.html Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796029 Share on other sites More sharing options...
phil88 Posted March 29, 2009 Author Share Posted March 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796057 Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 http://blogger.xs4all.nl/peterned/archive/2006/10/27/140300.aspx Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796077 Share on other sites More sharing options...
phil88 Posted March 29, 2009 Author Share Posted March 29, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796082 Share on other sites More sharing options...
darkfreaks Posted March 29, 2009 Share Posted March 29, 2009 marked as solved plz Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796084 Share on other sites More sharing options...
phil88 Posted March 29, 2009 Author Share Posted March 29, 2009 It would have happened sooner, I was just looking for the button to do it Hiding it down the bottom on it's own where it's not noticeable seems a bit odd to me. Quote Link to comment https://forums.phpfreaks.com/topic/151563-solved-force-a-browser-to-use-css-pseudo-class/#findComment-796088 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.