3D Hover Effect for Images
How do I make an 3d hover effect for images?
DescriptionA simple CSS3 3D experiment showing the conversion of an image into a realistic 3D cuboid on hover with a cool shadow effect.. What is a 3d hover effect for images? How do you make a 3d hover effect for images? This script and codes were developed by Stan Williams on 08 September 2022, Thursday.
3D Hover Effect for Images - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>3D Hover Effect for Images</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!-- Container -->
<div class="thumb"> <!-- Image --> <a href="#"> <!-- Label --> <span>Stan Williams ♫♪ Peace Pipe</span> </a>
</div>
<center><h3></h3></center>
</p> </p>
Photo credit: Copyright © Stan Williams 2007 <a href="Stanwilliamsmusic.com"> Stan Williams</a> <script src="js/index.js"></script>
</body>
</html>
3D Hover Effect for Images - Script Codes CSS Codes
/*custom font - Montserrat*/
@import url(https://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
/*forcing the body to take 100% height*/
html, body {min-height: 100%;}
/*a nice BG*/
body { background: #544; /*fallback*/ background: linear-gradient(#544, #565);
}
/*Thumbnail Background*/
.thumb { width: 300px; height: 300px; margin: 70px auto; perspective: 1000px;
}
.thumb a { display: block; width: 100%; height: 100%; /*double layered BG for lighting effect*/ background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url("https://farm3.staticflickr.com/2610/3984323849_359012ca55.jpg"); /*Illustration Graphic created by Stan Williams. Peace Pipe album Cover Copyright © 2007 Stan Williams. I just licensed this photo as © Attribution-NonCommercial-NoDerivs License on Flickr,just for this pen :-D http://creativecommons.org/licenses/by-nc-nd/3.0/us/ So, feel free to use it as a demo, etc if so desired.
https://farm3.staticflickr.com/2610/3984323849_359012ca55.jpg/ orig. there is 500x500px. I wanted to see a CD case do the 3D effect :D feel free - Stan Williams www.stanwilliamsmusic.com */ background-size: 0, cover; /*3d space for children*/ transform-style: preserve-3d; transition: all 0.5s;
}
.thumb:hover a {transform: rotateX(80deg); transform-origin: bottom;}
/*bottom surface */
.thumb a:after { /*36px high element positioned at the bottom of the image*/ content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 36px; /*inherit the main BG*/ background: inherit; background-size: cover, cover; /*draw the BG bottom up*/ background-position: bottom; /*rotate the surface 90deg on the bottom axis*/ transform: rotateX(90deg); transform-origin: bottom;
}
/*label style*/
.thumb a span { color: white; text-transform: uppercase; position: absolute; top: 100%; left: 0; width: 100%; font: bold 12px/36px Montserrat; text-align: center; /*the rotation is a bit less than the bottom surface to avoid flickering*/ transform: rotateX(-89.99deg); transform-origin: top; z-index: 1;
}
/*shadow*/
.thumb a:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); box-shadow: 0 0 100px 50px rgba(0, 0, 0, 0.5); transition: all 0.5s; /*by default the shadow will be almost flat, very transparent, scaled down with a large blur*/ opacity: 0.15; transform: rotateX(95deg) translateZ(-80px) scale(0.75); transform-origin: bottom;
}
.thumb:hover a:before { opacity: 1; /*blurred effect using box shadow as filter: blur is not supported in all browsers*/ box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5); /*pushing the shadow down and scaling it down to size*/ transform: rotateX(0) translateZ(-60px) scale(0.85);
}
3D Hover Effect for Images - Script Codes JS Codes
/*custom font - Montserrat*/
@import url(https://fonts.googleapis.com/css?family=Montserrat);
/*basic reset*/
* {margin: 0; padding: 0;}
/*forcing the body to take 100% height*/
html, body {min-height: 100%;}
/*a nice BG*/
body { background: #544; /*fallback*/ background: linear-gradient(#544, #565);
}
/*Thumbnail Background*/
.thumb { width: 400px; height: 300px; margin: 70px auto; perspective: 1000px;
}
.thumb a { display: block; width: 100%; height: 100%; /*double layered BG for lighting effect*/ background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)), url("http://thecodeplayer.com/u/m/i1.png"); /*disabling the translucent black bg on the main image*/ background-size: 0, cover; /*3d space for children*/ transform-style: preserve-3d; transition: all 0.5s;
}
.thumb:hover a {transform: rotateX(80deg); transform-origin: bottom;}
/*bottom surface */
.thumb a:after { /*36px high element positioned at the bottom of the image*/ content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 36px; /*inherit the main BG*/ background: inherit; background-size: cover, cover; /*draw the BG bottom up*/ background-position: bottom; /*rotate the surface 90deg on the bottom axis*/ transform: rotateX(90deg); transform-origin: bottom;
}
/*label style*/
.thumb a span { color: white; text-transform: uppercase; position: absolute; top: 100%; left: 0; width: 100%; font: bold 12px/36px Montserrat; text-align: center; /*the rotation is a bit less than the bottom surface to avoid flickering*/ transform: rotateX(-89.99deg); transform-origin: top; z-index: 1;
}
/*shadow*/
.thumb a:before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); box-shadow: 0 0 100px 50px rgba(0, 0, 0, 0.5); transition: all 0.5s; /*by default the shadow will be almost flat, very transparent, scaled down with a large blur*/ opacity: 0.15; transform: rotateX(95deg) translateZ(-80px) scale(0.75); transform-origin: bottom;
}
.thumb:hover a:before { opacity: 1; /*blurred effect using box shadow as filter: blur is not supported in all browsers*/ box-shadow: 0 0 25px 25px rgba(0, 0, 0, 0.5); /*pushing the shadow down and scaling it down to size*/ transform: rotateX(0) translateZ(-60px) scale(0.85);
} /*
Forked and modified by Stan Williams http://stans-songs.com and http://stanwilliamsmusic.com https://codepen.io/Stanssongs
http://stanwilliams.net
*/
//orig. code author https://twitter.com/thecodeplayer
Developer | Stan Williams |
Username | Stanssongs |
Uploaded | September 08, 2022 |
Rating | 3 |
Size | 4,341 Kb |
Views | 28,336 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Mouse Position Background Focus Effect | 4,213 Kb |
Animated Digital Flip Clock | 2,423 Kb |
Bootstrap Fontawesome Icon Social Buttons | 3,911 Kb |
Animated button effects using jquery, css, javascript and effeckts.js | 2,862 Kb |
Horizontal Menu Demo | 4,780 Kb |
Circular rotating music player with menu on back with html5 javascript and css3 | 5,572 Kb |
CSS social buttons and icons | 43,459 Kb |
CSS only simple parallax scroll | 3,708 Kb |
Background Image Slideshow Menu | 2,226 Kb |
Blog Page | 4,805 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
SVG email test v2.0 | M_J_Robbins | 2,090 Kb |
Chuck Norris Background | Manz | 1,967 Kb |
A Pen by Jason Kinney | Jason-kinney | 1,980 Kb |
V.35 The Monolith Update - Hero Release Notes | Jordan | 12,045 Kb |
Simple Buttons | Haydenmills | 1,750 Kb |
CircleType | Peterhry | 3,535 Kb |
Flat UI - Checkbox FIX | ARS | 2,663 Kb |
Form Labels | Bartuc | 2,717 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
Iron Man SVG Loading Animation | Andythayer | 3,069 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!