Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Titre du document</title> <style> .example { cursor: pointer; height: 300px; position: relative; overflow: hidden; width: 400px; text-align: center; } .example .fadedbox { background-color: #666666; position: absolute; top: 0; left: 0; color: #fff; -webkit-transition: all 300ms ease-out; -moz-transition: all 300ms ease-out; -o-transition: all 300ms ease-out; -ms-transition: all 300ms ease-out; transition: all 300ms ease-out; opacity: 0; width: 360px; height: 100px; padding: 130px 20px; } .example:hover .fadedbox { opacity: 0.8; } .example .text { -webkit-transition: all 300ms ease-out; -moz-transition: all 300ms ease-out; -o-transition: all 300ms ease-out; -ms-transition: all 300ms ease-out; transition: all 300ms ease-out; transform: translateY(30px); -webkit-transform: translateY(30px); } .example .title { font-size: 2.5em; text-transform: uppercase; opacity: 0; transition-delay: 0.2s; transition-duration: 0.3s; } .example:hover .title, .example:focus .title { opacity: 1; transform: translateY(0px); -webkit-transform: translateY(0px); } </style> </head> <body> <h2>Texte animé sur une image passée en survol</h2> <div class="example"> <img src="/uploads/media/default/0001/01/4982c4f43023330a662b9baed5a407e391ae6161.jpeg" alt="tile3" width="400" height="300" alt="house" /> <div class="fadedbox"> <div class="title text">Maison</div> </div> </div> </body> </html>