3D Hover Effect for Images

Developer
Size
4,341 Kb
Views
28,336

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 Previews

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>&nbsp;</p>
Photo credit: Copyright © Stan Williams 2007&nbsp;<a href="Stanwilliamsmusic.com"> Stan Williams</a> &nbsp; <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
3D Hover Effect for Images - Script Codes
3D Hover Effect for Images - Script Codes
Home Page Home
Developer Stan Williams
Username Stanssongs
Uploaded September 08, 2022
Rating 3
Size 4,341 Kb
Views 28,336
Do you need developer help for 3D Hover Effect for Images?

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!

Stan Williams (Stanssongs) Script Codes
Create amazing captions with AI!

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!