使用html+css實(shí)現(xiàn)頁(yè)面書(shū)本翻頁(yè)特效
效果:

實(shí)現(xiàn):
1.定義標(biāo)簽,shu是書(shū)本,feng是封面,wen是文字內(nèi)容。
<div class="shu">
<div class="feng"></div>
<div class="wen">
<h3 style="padding-top: 50px;padding-left: 40px;">Life of Pi</h3>
<p style=" padding-top: 20px; padding-left: 40px;padding-right: 15px;">
He lives in Scarborough. He's a small, slim man – nomore than five foot five. Dark hair, dark eyes. Hair greyingat the temples. Can't be older than forty. leasingcoffee-coloured complexion1. Mild fall weather, yet puts on abig winter parka with fur-lined hood2 for the walk to thediner.
</p>
</div>
</div>
2.定義書(shū)本的基本屬性,寬高,陰影等,偽類是下面和右面那兩條陰影。
.shu{
position: relative;
width: 300px;
height: 400px;
background-color: rgba(255, 255, 255, 0.774);
transform-style: preserve-3d;
box-shadow: 300px 0px 30px rgb(0, 0, 0,.6) inset;
transition: 1s cubic-bezier(.79,.34,.47,.92);
}
.shu::after{
content: '';
position: absolute;
height: 3px;
width: 303px;
left: 0px;
bottom: -3px;
/* background-color: rgb(100, 96, 96); */
background-image: linear-gradient(to right,rgb(71, 68, 68),rgba(124, 120, 120, 0.3) );
border-bottom-left-radius: 5px;
}
.shu::before{
content: '';
position: absolute;
width: 3px;
height: 100%;
right: -3px;
top: 0px;
background-color: rgb(112, 108, 108);
background-image: linear-gradient(to top,rgb(114, 111, 111),rgba(90, 87, 87, 0.5) );;
border-top-right-radius: 3px;
}
transition: 1s cubic-bezier(.79,.34,.47,.92); 變化時(shí)間為1s,運(yùn)動(dòng)曲線為 cubic-bezier(.79,.34,.47,.92),這個(gè)可以去一個(gè)網(wǎng)站自定義生成:點(diǎn)我。

3.鼠標(biāo)經(jīng)過(guò),陰影變化,然后書(shū)本向左旋轉(zhuǎn):
.shu:hover{
box-shadow: 30px 0px 30px rgb(0, 0, 0,.6) inset;
transform: rotate(-5deg);
}
transform: rotate(-5deg);旋轉(zhuǎn);
4.封面的基本樣式:
.feng{
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
background-image: url(4.jpg);
background-size: 100% ;
transform-origin: left;
transition: 1s cubic-bezier(.79,.34,.47,.92);
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
transform-origin: left; 封面旋轉(zhuǎn)的位置,旋轉(zhuǎn)點(diǎn)
5.封面旋轉(zhuǎn):
.shu:hover .feng{
transform: rotateY(-140deg);
}
文本的基本屬性:
.wen{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-family: 'fangsong';
text-align: left;
}
完整代碼:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
height: 100vh;
background-image: radial-gradient(white,black);
display: flex;
justify-content: center;
align-items: center;
}
.shu{
position: relative;
width: 300px;
height: 400px;
background-color: rgba(255, 255, 255, 0.774);
transform-style: preserve-3d;
box-shadow: 300px 0px 30px rgb(0, 0, 0,.6) inset;
transition: 1s cubic-bezier(.79,.34,.47,.92);
}
.shu::after{
content: '';
position: absolute;
height: 3px;
width: 303px;
left: 0px;
bottom: -3px;
/* background-color: rgb(100, 96, 96); */
background-image: linear-gradient(to right,rgb(71, 68, 68),rgba(124, 120, 120, 0.3) );
border-bottom-left-radius: 5px;
}
.shu::before{
content: '';
position: absolute;
width: 3px;
height: 100%;
right: -3px;
top: 0px;
background-color: rgb(112, 108, 108);
background-image: linear-gradient(to top,rgb(114, 111, 111),rgba(90, 87, 87, 0.5) );;
border-top-right-radius: 3px;
}
.shu:hover{
box-shadow: 30px 0px 30px rgb(0, 0, 0,.6) inset;
transform: rotate(-5deg);
}
.feng{
position: absolute;
width: 100%;
height: 100%;
z-index: 2;
background-image: url(4.jpg);
background-size: 100% ;
transform-origin: left;
transition: 1s cubic-bezier(.79,.34,.47,.92);
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}
.shu:hover .feng{
transform: rotateY(-140deg);
}
.wen{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-family: 'fangsong';
text-align: left;
}
</style>
</head>
<body>
<div class="shu">
<div class="feng"></div>
<div class="wen">
<h3 style="padding-top: 50px;padding-left: 40px;">Life of Pi</h3>
<p style=" padding-top: 20px; padding-left: 40px;padding-right: 15px;">
He lives in Scarborough. He's a small, slim man – nomore than five foot five. Dark hair, dark eyes. Hair greyingat the temples. Can't be older than forty. leasingcoffee-coloured complexion1. Mild fall weather, yet puts on abig winter parka with fur-lined hood2 for the walk to thediner.
</p>
</div>
</div>
</body>
</html>
到此這篇關(guān)于使用html+css實(shí)現(xiàn)頁(yè)面書(shū)本翻頁(yè)效果的文章就介紹到這了,更多相關(guān)html+css書(shū)本翻頁(yè)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
純JS實(shí)現(xiàn)的批量圖片預(yù)覽加載功能
需要一張轉(zhuǎn)圈的小圖片,需要預(yù)覽的所有圖片默認(rèn)的位置全是這張小圖片,滾輪滾到原圖需要出現(xiàn)的位置時(shí)候,預(yù)覽加載替換小圖片2011-08-08
javascript 圖片放大縮小功能實(shí)現(xiàn)代碼
很早以前寫(xiě)的一個(gè)效果,今天有時(shí)間了整理出來(lái) 通過(guò) Math.pow(x,y) 的“冪”運(yùn)算來(lái)計(jì)算大小圖片放大縮小的尺寸2011-07-07
javascript預(yù)覽上傳圖片發(fā)現(xiàn)的問(wèn)題的解決方法
前段時(shí)間做一個(gè)行業(yè)站點(diǎn),其中商鋪有一塊功能是商鋪設(shè)置功能,要求是進(jìn)行版式,企業(yè)名稱,企業(yè)頭部LOGO,企業(yè)頭部背景進(jìn)行自定義設(shè)置。2010-11-11
Javascript+CSS實(shí)現(xiàn)Flash動(dòng)態(tài)新聞效果(pp原創(chuàng))
Javascript+CSS實(shí)現(xiàn)Flash動(dòng)態(tài)新聞效果(pp原創(chuàng))2008-10-10
靜態(tài)圖片的十一種濾鏡效果--不支持Ie7及非IE瀏覽器。
靜態(tài)圖片的十一種濾鏡效果--不支持Ie7及非IE瀏覽器。...2007-03-03
簡(jiǎn)單的實(shí)現(xiàn)點(diǎn)擊箭頭圖片切換的js代碼
這個(gè)是一個(gè)簡(jiǎn)單的點(diǎn)擊箭頭圖片切換的例子。JS部分采用過(guò)的是jQuery2012-11-11

