February 16, 201016 yr I'm trying to put together the simplest possible code for some buttons in my sidebar in the html <a href="http://www.mydomain.com/contact" id="buttonContactEmail" class="sidebarButton"></a> and the css class .sidebarButton { width:225px; height:59px; display:block; } and id #buttonContactEmail, #buttonContactEmail a:link, #buttonContactEmail a:visited {background-image:url(images/buttonContactEmail.png);} #buttonContactEmail a:hover, #buttonContactEmail a:active {background-image:url(images/buttonContactEmailHover.png);} The button shows up fine. The only thing that doesn't work is the hover/active background change. The image name and location for the rollover image are definatly correct. I had a look in firebug and #buttonContactEmail a:hover, #buttonContactEmail a:active {background-image:url(images/buttonContactEmailHover.png);} isn't getting loaded at all, its not being superceded by another css value, its just not getting loaded. Its in the same css file as the #buttonContactEmail, #buttonContactEmail a:link, #buttonContactEmail a:visited line and the class value Aby ideas? Thanks
February 16, 201016 yr a:hover will only hover the link text, you need to use :hover ( #buttonContactEmail:hover ) to get the button to hover. It might not work on versions of IE though
February 16, 201016 yr It's the other way around. This: #buttonContactEmail a:hover, #buttonContactEmail a:active {background-image:url(images/buttonContactEmailHover.png);} Should be this: a#buttonContactEmail:hover, a#buttonContactEmail:active {background-image:url(images/buttonContactEmailHover.png);} Hope this helps.
Create an account or sign in to comment