Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Image Hover Over change with One jpeg image

Posted on 2014-09-11
2
Medium Priority
?
189 Views
Last Modified: 2014-09-30
I have been tasked with writing multiple CSS classes for one image.  It is basically a social bar that when you hover over the link, the link changes color.  There is one image that contains 4 images meant for hover over and one image meant for the default image before hover over.  When the user hovers over the image or link, the css coordinates change to be another image within the one jpeg image to show the hovered image.  How am I supposed to do this so that it works?  The image looks like the following: SEE ATTACHED IMAGE.socialbar.jpg
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 1000 total points
ID: 40317678
That is a 'sprite' image.  The CSS will declare a 'div' with the right dimensions to show only one of the images and the background position will be adjusted so the correct one shows thru.  When you 'hover' over it, the CSS 'hover' code will change the background position to show the image of the other color.  More info here: http://www.w3schools.com/css/css_image_sprites.asp
0
 
LVL 13

Assisted Solution

by:Abhijeet Rananaware
Abhijeet Rananaware earned 1000 total points
ID: 40325353
You can use background-position property for changing position on spirite image.

divimage{
       display: block;
       background: url(sprite.png) no-repeat;
       height: 30px;
       width: 250px;
}

divimage:hover {
       background-position: 0 -30px;
}

Open in new window


Adjust background-position for each hover .
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question