Solved

css change container image on hover

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
compact pure CSS Read More Toggle 4 149
SlickNav Menu Plugin Not appearing on mobile 6 53
Change of column alignment in div 2 23
Checkout Page Input Field not aligned 1 26
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 describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

840 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