In CSS3, we can create an effect, wherein, on hovering the image, it displays it's information. This utility can be variously used, as for the pricing of any product in a catalogue or personal details etc. An example of the same is shown below. Kindly mouse over the images for information display.
For the above effect the CSS3 styles and HTML code for the same is given below:
1. Firstly, the background for the images was given
|
#prod_display_gal_main
|
Here wooden plank was given as the background. Next we assign a placeholder for the images as shown below.
|
#prod_display_gallery
|
|
#prod_display_gallery ul |
|
#prod_display_gallery ul li
|
4. In this step we specify padding and margin for our image
|
#prod_display_gallery ul li img |
5. In this step we assign a placeholder for the product information
|
#prod_display_gallery ul li c |
In the above style, the placeholder for product information does not show before hovering due to 'display: none;' property.
On hovering, we do not wish to show our image and so for that we give the code as:
|
#prod_display_gallery ul li:hover img |
6. In this step we assign a style for the product information placeholder, when the list is hovered over
|
#prod_display_gallery ul li:hover c |
The HTML code for the above result is given below:
|
<div id="prod_display_gal_main"> <ul> |
That's all folks. Hope you found it simple and would try it out yourself.
Tags: CSS3 product display tutorial, CSS3 tutorial to display products and its description