css实现一个鼠标悬浮翻书带封面动画效果代码

代码语言:html

所属分类:悬停

代码描述:css实现一个鼠标悬浮翻书带封面动画效果代码

代码标签: 鼠标 悬浮 翻书 封面 动画 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>

<html lang="en" class="no-js">

	<head>

		<meta charset="UTF-8" />

<style>
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600&subset=latin,latin-ext);


.container > header,
.codrops-top {
	font-family: 'Lato', Arial, sans-serif;
	color: #34495e;
}

.container > header {
	margin: 0 auto;
	padding: 2em;
	text-align: center;
	background: #34495e;
	color: #fff;
}

.container > header h1 {
	font-size: 2.625em;
	line-height: 1.3;
	margin: 0;
	font-weight: 300;
}

.container > header span {
	display: block;
	font-size: 60%;
	color: #16a085;
	padding: 0 0 0.6em 0.1em;
}

/* To Navigation Style */
.codrops-top {
	background: #253749;
	text-transform: uppercase;
	width: 100%;
	font-size: 0.69em;
	line-height: 2.2;
}

.codrops-top a {
	text-decoration: none;
	padding: 0 1em;
	letter-spacing: 0.1em;
	color: #fff;
	display: inline-block;
}

.codrops-top a:hover {
	background: rgba(255,255,255,0.1);
	color: #fff;
}

.codrops-top span.right {
	float: right;
}

.codrops-top span.right a {
	float: left;
	display: block;
}

.codrops-icon:before {
	font-family: 'codropsicons';
	margin: 0 4px;
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
}

.codrops-icon-drop:before {
	content: "\e001";
}

.codrops-icon-prev:before {
	content: "\e004";
}

/* Demo Buttons Style */
.codrops-demos {
	padding-top: 1em;
	font-size: 0.9em;
}

.codrops-demos a {
	text-decoration: none;
	outline: none;
	display: inline-block;
	margin: 0.5em;
	font-size: 1.1em;
	padding: 0.7em 1.1em;
	border: 3px solid #16a085;
	color: #16a085;
	font-weight: 700;
}

.codrops-demos a:hover,
.codrops-demos a.current-demo,
.codrops-demos a.current-demo:hover {
	border-color: #fff;
	color: #fff;
}

p.note {
	font-size: 1.1em;
	text-align: center;
	padding: 40px 10px 100px;
	max-width: 700px;
	margin: 0 auto;
	line-height: 1.4;
}

@media screen and (max-width: 25em) {

	.codrops-icon span {
		display: none;
	}

}
    @import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,600&subset=latin,latin-ext);
/*
	A. Mini Reset 
*/
*, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }

* {
  margin: 0;
  padding: 0;
}

::before,
::after {
	content: "";
}

html,
body {
	height: 100%;
	-webkit-font-smoothing: subpixel-antialiased;
}

html {
	font-size: 100%;
}

body {
	background: #ecf0f1;
	color: #34495e;
	font-family: 'Lato', 'Arial', sans-serif;
	font-weight: 400;
	line-height: 1.2;
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

a {
	color: #2c3e50;
	text-decoration: none;
}

.btn {
	display: inline-block;
	margin-top: 100px; 
	font-size: 1.2em;
	font-weight: 700;
	padding: 0.1em 0.8em;
	text-align: center;
	-webkit-transform: rotate(20deg);
	-moz-transform: rotate(20deg);
	transform: rotate(20deg);
	font-family: "Indie Flower", serif;
	-webkit-transition: color 0.3s;
	-moz-transition: color 0.3s;
	transition: color 0.3s;
}

.btn:hover {
	color: #16a085;
}

/* basic grid, only for this demo */

.align {
	clear: both;
	margin: 90px auto 20px;
	width: 100%;
	max-width: 1170px;
	text-align: center;
}

.align > li {
	width: 500px;
	min-height: 300px;
	display: inline-block;
	margin: 30px 20px 30px 60px;
	padding: 0 0 0 60px;
	vertical-align: top;
}

/* ///////////////////////////////////////////////////

PAPERBACK
Table of Contents

1. container
2. background & color
3. opening cover, back cover and pages
4. position, transform y transition
5. events
6. Bonus
	- Ribbon
	- Figcaption
7. mini-reset

/////////////////////////////////////////////////////*/

/*
	1. container
*/

.book {
	position: relative;
	width: 160px; 
	height: 220px;
	-webkit-perspective: 1000px;
	-moz-perspective: 1000px;
	perspective: 1000px;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	transform-style: preserve-3d;
}

/*
	2. background & color
*/

/* HARDCOVER FRONT */

.paperback_front {
	background-color: #000;
}

.paperback_front::after{
	background-image: -webkit-linear-gradient( -135deg, rgba(255, 255, 255, 0.45) 0%, transparent 100%);
	background-image: -moz-linear-gradient( -135deg, rgba(255, 255, 255, 0.45) 0%, transparent 100%);
	background-image: linear-gradient( -135deg, rgba(255, 255, 255, 0.45) 0%, transparent 100%);
	position: absolute;
	top: 0;
	left: 0;
	bottom: 0;
	right: 0;
}

.paperback_back {
	background-color: #333;
}

/* page */

.ruled_paper > li {
	background-color: #fff;
	background-image: -webkit-linear-gradient(rgba(200, 200, 200, 0.1) 0.1em, transparent 0.1em), -webkit-linear-gradient(left, #e1ddd8 0%, #fffbf6 100%);
	background-image: -moz-linear-gradient(rgba(200, 200, 200, 0.1) 0.1em, transparent 0.1em), -moz-linear-gradient(left, #e1ddd8 0%, #fffbf6 100%);
	background-image: -ms-linear-gradient(rgba(200, 200, 200, 0.1) 0.1em, transparent 0.1em), -moz-linear-gradient(left, #e1ddd8 0%, #fffbf6 100%);
	background-image: linear-gradient(rgba(200, 200, 200, 0.1) 0.1em, transparent 0.1em), linear-gradient(left, #e1ddd8 0%, #fffbf6 100%);
	background-size: 100% 0.6em;
	box-shadow: inset 0px -1px 2px rgba(50, 50, 50, 0.1), inset -1px 0px 1px rgba(150, 150, 150, 0.2);
	border-radius: 0px 10px 10px 0px;
}

/*
	3. opening cover, back cover and pages
*/

.paperback_front {
	-webkit-transform: rotateY(-38deg) translateZ(0px);
	-moz-transform: rotateY(-38deg) translateZ(0px);
	transform: rotateY(-38deg) translateZ(0px);
	z-index: 100;
}

.paperback_back {
	-webkit-transform: rotateY(-25deg);
	-moz-transform: rotateY(-25deg);
	transform: rotateY(-25deg);
}

.ruled_paper li:nth-child(1) {
	-webkit-transform: rotateY(-27deg);
	-moz-transform: rotateY(-27deg);
	transform: rotateY(-27deg);
}

.ruled_paper li:nth-child(2) {
	-webkit-transform: rotateY(-29deg);
	-moz-transform: rotateY(-29deg);
	transform: rotateY(-29deg);
}

.ruled_paper li:nth-child(3) {
	-webkit-transform: rotateY(-31deg);
	-moz-transform: rotateY(-31deg);
	transform: rotateY(-31deg);
}

.ruled_paper li:nth-child(4) {
	-webkit-transform: rotateY(-33deg);
	-moz-transform: rotateY(-33deg);
	transform: rotateY(-33deg);
}

.ruled_paper li:nth-child(5) {
	-webkit-transform: rotateY(-35deg);
	-moz-transform: rotateY(-35deg);
	transform: rotateY(-35deg);
}

/*
	4. position, transform y transition
*/

.paperback_front,
.paperback_back,
.paperback_front li,
.paperback_back li {
	border-radius: 2px 8px 8px 2px;
	position: absolute;
	top: 0;
	left: 0px;
	width: 100%;
	height: 100%;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	transform-style: preserve-3d;
}

.paperback_front,
.paperback_back {
	-webkit-transform-origin: 0% 100%;
	-moz-transform-origin: 0% 100%;
	transform-origin: 0% 100%;
}

.paperback_front{
	-webkit-transition: all 0.5s ease, z-index 0.6s;
	-moz-transition: all 0.5s ease, z-index 0.6s;
	transition: all 0.5s ease, z-index 0.6s;
}

.paperback_front li img,
.paperback_back li img {
	border-radius: 2px 8px 8px 2px;
	position: absolute;
	top: 0;
	left: 0;
}

/* Ruled paper */

.ruled_paper,
.ruled_paper > li {
	position: absolute;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	transform-style: preserve-3d;
}

.ruled_paper {
	width: 98%;
	height: 98%;
	top: 1%;
	left: 1%;
	z-index: 10;
}

.ruled_paper > li {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
}

.ruled_paper > li {
	-webkit-transform-origin: left center;
	-moz-transform-origin: left center;
	transform-origin: left center;
	-webkit-transition-property: transform;
	-moz-transition-property: transform;
	transition-property: transform;
	-webkit-transition-timing-function: ease;
	-moz-transition-timing-function: ease;
	transition-timing-function: ease;
}

.ruled_paper li:nth-child(1) {
	-webkit-transition-duration: 0.6s;
	-moz-transition-duration: 0.6s;
	transition-duration: 0.6s;
}

.ruled_paper li:nth-child(2) {
	-webkit-transition-duration: 0.6s;
	-moz-transition-duration: 0.6s;
	transition-duration: 0.6s;
}

.ruled_paper li:nth-child(3) {
	-webkit-transition-duration: 0.4s;
	-moz-transition-duration: 0.4s;
	transition-duration: 0.4s;
}

.ruled_paper li:nth-child(4) {
	-webkit-transition-duration: 0.5s;
	-moz-transition-duration: 0.5s;
	transition-duration: 0.5s;
}

.ruled_paper li:nth-child(5) {
	-webkit-transition-duration: 0.5s;
	-moz-transition-duration: 0.5s;
	transition-duration: 0.5s;
}

/*
	5. events
*/

.book:hover > .paperback_front {
	-webkit-transform: rotateY(-125deg) translateZ(0px);
	-moz-transform: rotateY(-125deg) translateZ(0px);
	transform: rotateY(-125deg) translateZ(0px);
	z-index: 0;
}

.book:hover > .ruled_paper li:nth-child(1) {
	-webkit-transf.........完整代码请登录后点击上方下载按钮下载查看

网友评论0