CSS3 Shopping Website Product text Prompt example

Source: Internet
Author: User

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:

  1. <! DOCTYPE html>
  2. <meta charset= "UTF-8" >
  3. <title> Shopping website Product text Tips </title>
  4. <style type= "Text/css" >
  5. *{margin:0;padding:0;}
  6. #con {width:500px;height:470px;margin:50px auto;position:relative;}
  7. #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;}
  8. #con: hover p{height:30px;}
  9. </style>
  10. <body>
  11. <div id= "Con" >
  12. <p> Teddy Bear </p>
  13. </div>
  14. </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.