Solved

css change container image on hover

Posted on 2013-11-04
4
265 Views
Last Modified: 2013-11-08
Hi guys,

I am trying to get the container image to change here (http://www.deans-place.co.uk/problem.html) using :hover.

Firstly any idea why its not working? And secondly, I have a feeling each of my divs inside the container will try to take on the :hover background? which obv I don't want.

Thanks,
Dean
0
Comment
Question by:deanlee17
  • 2
4 Comments
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39621154
If you're talking about the .Homepage_Container1, then this will do it:

.Homepage_Container1:hover {
   background-image: url('someImage.jpg');
}

Open in new window

0
 
LVL 1

Expert Comment

by:Chris--W
ID: 39621190
The other option is to use HTML rather than CSS, since your images aren't backgrounds:

<img src="image1.gif"
onmouseover="this.src='image2.gif'"
onmouseout="this.src='image1.gif'"> 

Open in new window

0
 

Author Comment

by:deanlee17
ID: 39621205
I think ChrisStanyon is correct here as the container image is a background image. But a useful tip from Chris-W.

Thanks guys.
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39621213
FYI - dropping javascript in-line is not really considered best practice anymore.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Configuring a checkbox in CSS and php 18 88
CSS Logo Problem. 2 20
Botom of page is wrong color 5 11
Customizing jQuery UI Accordion CSS 3 12
When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
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 customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

776 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