Solved

css change container image on hover

Posted on 2013-11-04
4
260 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 42

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 42

Expert Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now