CSS Background-Position Rollover Broken in IE

This is a discussion on "CSS Background-Position Rollover Broken in IE" within the Web Page Design section. This forum, and the thread "CSS Background-Position Rollover Broken in IE are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Apr 16th, 2008, 04:01
Junior Member
Join Date: Nov 2007
Location: Michigan
Age: 22
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Background-Position Rollover Broken in IE

This displays properly in Firefox with the rollover, and the image itself appears in Internet Explorer. However, IE doesn't hover properly nor does it indicate it's a link (with the hand), but it's still clickable. Here's the CSS and then the code used to make it happen. Anyone know how to fix this?

Link to Site (New Thread button)

CSS
Code: Select all
.newthread a {
    display:block;
    width:105px;
    height:24px;
    background:url(../../images/cb-template-1/buttons/newthread.png);
}

.newthread a:hover {
    background-position: 0 -24px; }
HTML
Code: Select all
<div class="newthread">
<a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="clear.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>
</div>
Reply With Quote

  #2 (permalink)  
Old Apr 16th, 2008, 12:58
Aso's Avatar
Aso Aso is offline
Chief Moderator

SuperMember
Join Date: Oct 2007
Location: UK
Posts: 942
Blog Entries: 2
Thanks: 5
Thanked 18 Times in 16 Posts
Send a message via Skype™ to Aso
Re: CSS Background-Position Rollover Broken in IE

Try this instead;
Code: Select all
.newthread a {
    display:block;
    width:105px;
    height:24px;
    background:url(../../images/cb-template-1/buttons/newthread.png);
    overflow: hidden;
}

.newthread a img {
   border: none;
}

.newthread a:hover {
    background-position: 0 -24px;
    text-indent: -5000px
}
HTML
HTML: Select all
<div class="newthread">
<a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="../../images/cb-template-1/buttons/newthread.png" alt="$vbphrase[post_new_thread]" /></a>
</div>
Last Blog Entry: The Google Misconception (Feb 3rd, 2008)

Last edited by Aso; Apr 16th, 2008 at 13:00.
Reply With Quote
  #3 (permalink)  
Old Apr 16th, 2008, 20:54
Junior Member
Join Date: Nov 2007
Location: Michigan
Age: 22
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Background-Position Rollover Broken in IE

Hey everyone, the problem was solved. For sake of knowing the actual problem and the solution, here's what happened:

The PNG files I use have transparency in them. Because of this, I have a separate file that fixes the alpha transparency for IE. A common problem with this approach is the inability to select anything within the container. What I did was turn the gray part of the button into a background. Within that container, using position:relative to "fix" a layer above it, I did the same thing with just a .jpg file as the background image that rolls over. End result:

http://www.castbuzz.com/community/forumdisplay.php?f=20

CSS
Code: Select all
.buttongray {
    display:block;
    width:105px;
    height:24px;
    background:url(http://www.castbuzz.com/community/images/cb-template-1/buttons/button.png);
    overflow:hidden;
    padding:0px;
    margin:0px;
}

.newthread a {
    display:block;
    position:relative;
    width:92px;
    height:16px;
    background:url(http://www.castbuzz.com/community/images/cb-template-1/buttons/newthread.jpg);
    overflow:hidden;
    padding:0;
    margin:2px 0 0 4px;
}

.newthread a:hover {
    background-position: 0 -16px;
    text-indent: -5000px;
    padding:0;
    margin:2px 0 0 4px;
}
HTML (within vB)
Code: Select all
<div class="buttongray"><div class="newthread"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]" rel="nofollow"><img src="clear.gif" width="94" height="16" alt="" /></a></div></div>
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Background-Position Causes IE to Scroll Aerdan Web Page Design 2 May 11th, 2008 01:37
background-image rollover problem ie6 ukstoner Web Page Design 6 Apr 9th, 2008 14:00
Background colour rollover? crackafaza Web Page Design 6 Apr 4th, 2008 10:22
a:hover and background-position issue with ie6 mezema Web Page Design 5 Jun 15th, 2006 15:32
background-position:bottom; <-- not working ? ifunky2 Web Page Design 2 Feb 14th, 2006 21:56


All times are GMT. The time now is 05:12.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43