glenelkins Posted February 2, 2009 Share Posted February 2, 2009 Hi Lets say i have a nav item like this: .navitem a { display:block; text-indent:-3000px; overflow:hidden; width: 100px; height: 30px; background: url('../images/nav/test.png') no-repeat; } .navitem a:hover { background-position: -100px; } .navitem span { position: absolute; margin-top: 10px; margin-left: 10px; color: red; } <div class="navitem"><span>TEXT HERE</span><a href="">Link Item</a></div> How can i make it so when the link background image is hovered over, the text colour outside of the link changes too? When rolling over all this will do is pick the .navitem a:hover class and scroll the background image...im not sure how to make the text in the <span> change The span needs to be outisde the <a> for a reason! Link to comment https://forums.phpfreaks.com/topic/143460-effect-a-class-from-rollover-of-another/ Share on other sites More sharing options...
rhodesa Posted February 2, 2009 Share Posted February 2, 2009 with just CSS and working on all browsers...you can't. CSS3 has a standard for CSS selectors that will support this, but it's not widely used yet. you will have to use JS to accomplish this Link to comment https://forums.phpfreaks.com/topic/143460-effect-a-class-from-rollover-of-another/#findComment-752520 Share on other sites More sharing options...
glenelkins Posted February 2, 2009 Author Share Posted February 2, 2009 bugger! i dont really fancy using javascript for it...but looks at though may need to be done...i think jquery would work best really! Link to comment https://forums.phpfreaks.com/topic/143460-effect-a-class-from-rollover-of-another/#findComment-752603 Share on other sites More sharing options...
rhodesa Posted February 2, 2009 Share Posted February 2, 2009 yes...jQuery would be simple: $('.navitem').hover( function(){ $(this).addClass('hover'); }, function(){ $(this).removeClass('hover'); } ); .navitem.hover span { color: blue; } Link to comment https://forums.phpfreaks.com/topic/143460-effect-a-class-from-rollover-of-another/#findComment-752610 Share on other sites More sharing options...
glenelkins Posted February 3, 2009 Author Share Posted February 3, 2009 its all good! cheers mate. safe! Link to comment https://forums.phpfreaks.com/topic/143460-effect-a-class-from-rollover-of-another/#findComment-753362 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.