CSS3 Shopping Website Product text Prompt example
First Look at:
<ignore_js_op>
When the mouse across the picture, there is a black rectangular background of teddy bear will appear.
Look at the HTML5+CSS3 code:
- <! DOCTYPE html>
- <meta charset= "UTF-8" >
- <title> Shopping website Product text Tips </title>
- <style type= "Text/css" >
- *{margin:0;padding:0;}
- #con {width:500px;height:470px;margin:50px auto;position:relative;}
- #con p{background: #000; color: #fff; width:100%;height:30px;text-align:center;line-height:30px;position:absolute; Left:0;bottom:0;opacity:0.6;height:0;-webkit-transition:height 0.5s;}
- #con: hover p{height:30px;}
- </style>
- <body>
- <div id= "Con" >
- <p> Teddy Bear </p>
- </div>
- </body>
Copy Code
Code Explanation:
Build a div,div to store a picture of a product that needs to be displayed, and then add a text representation of the product's image,
Add CSS style attributes to the div and add CSS style attributes to the P element, where the height is set to 0 and not visible. Focus on the use of absolute positioning and relative positioning, and they do not understand, please see this sticker http://www.00h5.com/thread-133-1-1.html
The description text positioning and add transition animation, here we want the mouse across the div when the change is only the height of the original 30px can be, and animation is also set the height of the property
CSS3 Shopping Website Product text Prompt example