Lien d’origine: https://codepen.io/ddharvesh/pen/abNNWze
HTML:
<section class="rippedImage"> <div class="container"> <div class="cardRipped"> <img class="image" src="http://localhost/wordpress/wp-content/themes/theme-bulma-v4.1.2/css/img/daffodil.jpg"></img> <div class="info"> <h2>About me</h2> <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Possimus libero voluptatum sit! Sequi facere in tempora quibusdam mollitia provident aut?</p> </div> </div> <div class="cardRipped"> <div class="image"><img class="image" src="http://localhost/wordpress/wp-content/themes/theme-bulma-v4.1.2/css/img/sea.jpg"></img></div> </div> <div class="cardRipped"> <div class="image"><img class="image" src="http://localhost/wordpress/wp-content/themes/theme-bulma-v4.1.2/css/img/sunset.jpg"></img></div> </div> </div> <svg> <filter id="wavy1"> <feturbulence x="0" y="0" baseFrequency="0.2" numOctaves="5" seed="1"></feturbulence> <feDisplacementMap in="SourceGraphic" scale="20" /> </filter> </svg> <svg> <filter id="wavy2"> <feturbulence x="0" y="0" baseFrequency="0.02" numOctaves="5" seed="1"></feturbulence> <feDisplacementMap in="SourceGraphic" scale="20" /> </filter> </svg> <svg> <filter id="wavy3"> <feturbulence x="0" y="0" baseFrequency="0.1" numOctaves="5" seed="1"></feturbulence> <feDisplacementMap in="SourceGraphic" scale="20" /> </filter> </svg> </section>
CSS:
.rippedImage { font-family: Verdana, Geneva, Tahoma, sans-serif; display: flex; justify-content: center; align-items: center; min-height: 120px; background: #f4f4f4; padding: 20px; } .rippedImage .container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; } .rippedImage .container .cardRipped { position: relative; width: 300px; height: 380px; margin: 30px; } .rippedImage .container .cardRipped:nth-of-type(2) { transform: rotate(5deg); } .rippedImage .container .cardRipped .image { position: relative; width: 280px; height: 350px; background-size: cover; transform: translate(10px, 10px); } .rippedImage .container .cardRipped:before { content: ""; position: absolute; top: 0; left: 0; width: 300px; height: 380px; border: 25px solid #fff; z-index: 1; background: linear-gradient(145deg, #ffffff, #e6e6e6); box-shadow: 7px 7px 21px #bdbdbd, -7px -7px 21px #ffffff; background: transparent; } .rippedImage .container .cardRipped:nth-of-type(1)::before { filter: url(#wavy1); } .rippedImage .container .cardRipped:nth-of-type(2)::before { filter: url(#wavy2); } .rippedImage .container .cardRipped:nth-of-type(3)::before { filter: url(#wavy3); } .rippedImage svg { width: 0; height: 0; } .rippedImage .container .cardRipped .info { position: absolute; top: 0; left: 0; width: 290px; height: 370px; padding: 50px 30px 30px 30px; transform: translate(10px, 10px); text-align: center; background-color: rgba(0, 0, 0, 0.5); color: #fff; line-height: 1.4; font-size: 20px; opacity: 0; transition-duration: 1s; } .rippedImage .container .cardRipped:hover .info { opacity: 1; }