Solved

css - image hovering

Posted on 2011-02-22
4
333 Views
Last Modified: 2012-05-11
I would like to know if it is possible in css to define a:hover, where an image appear.

For example an nearly transparent white layer that appears on top, when moving the mouse over a field.

Fx.
a:hover {
background-image etc etc
}
0
Comment
Question by:rossoneris
[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
4 Comments
 
LVL 16

Expert Comment

by:SSupreme
ID: 34951623
yes, it is possible.
0
 

Author Comment

by:rossoneris
ID: 34951808
Do you have an small example ? -

0
 
LVL 16

Expert Comment

by:SSupreme
ID: 34951945
0
 
LVL 3

Accepted Solution

by:
thecrew earned 125 total points
ID: 34962296
An easy way is to make a background image that is twice as high as the element you are dealing with, the top half of the image would be what the user would see when they are not hovering over the element, then the bottom half would be what they should see when they are hovering over. Then all you do is apply the image as a background to your element and move it by the height of the element when the item is hovered.

For this example the element is 42px tall, but the background image would be 84px tall.
CSS:
<style type="text/css">

#itemID {
	display:block; /* if it's not already a block level element */
	width:150px;
	height:42px;
	background:url("images/translucent_image.png") no-repeat scroll 0 0 transparent;
}

#itemID:hover {
	background-position:0 -42px;
}

</style>

Open in new window


HTML:
<a href="#" id="itemID"></a>

Open in new window


Good luck!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress themes CSS? 6 30
CSS in HTML 5 52
ASP sending two datas 2 23
HTML INPUT 6 19
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

749 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