We help IT Professionals succeed at work.

CSS Sprite Help Required

EzEApostle asked
Last Modified: 2012-06-27
Hi all, hope you're all well.

I'm currenty designing a new site and was hoping to use Sprites for the first time... This leads me onto my question! I know how to set the variables with the image but when I mouse over the image isn't corretly highlighting the correct part of my mouseover image, can anyone spot the obvious error? :)

<style type="text/css">
#header_menu {
	width:228px; height:165px;
	margin:10px auto; padding:0;
#header_menu li {
	margin:0; padding:0; list-style:none;
	position:absolute; top:0;
#header_menu li, #header_menu a {
	height:165px; display:block;
#header_menu_1 {top:0px; height:57px; width:228px;}
#header_menu_2 {top:57px; height:52px; width:228px;}
#header_menu_3 {top:109px; height:58px; width:228px;}
#header_menu_1 a:hover {
    background: transparent url(http://img237.imageshack.us/img237/5791/headermenuus2.jpg);
#header_menu_2 a:hover {
    background: transparent url(http://img237.imageshack.us/img237/5791/headermenuus2.jpg);
#header_menu_3 a:hover {
    background: transparent url(http://img237.imageshack.us/img237/5791/headermenuus2.jpg)
    0 272px;
          <ul id="header_menu">
            <li id="header_menu_1"><a href="#1"></a></li>
            <li id="header_menu_2"><a href="#2"></a></li>
            <li id="header_menu_3"><a href="#3"></a></li>

Open in new window

Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)


Great stuff it works perfectly on highlight, there is one problem I notice however. Looking in IE and FF there is a difference in the horizontal positioning, do you know whats causing it?

David S.Consultant & Challenge Subduer
Top Expert 2009

Adding a doctype may help and even if it doesn't make a difference, you should be using one anyway: http://dev.opera.com/articles/view/14-choosing-the-right-doctype-for-your/

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.