CSS實(shí)現(xiàn)3D書(shū)本效果的示例代碼
發(fā)布時(shí)間:2020-06-11 17:10:56 作者:loving-cat
我要評(píng)論

這篇文章主要介紹了CSS實(shí)現(xiàn)3D書(shū)本效果的實(shí)例代碼,代碼簡(jiǎn)單易懂,對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧
話(huà)不多說(shuō),先來(lái)看一下效果圖
源代碼如下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <style> *{ margin: 0; padding: 0; } body{ display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100vh; background: #333333; background-size: cover; } .book{ width: 400px; height: 600px; position: relative; background-color: #ffffff; transform: rotate(-37.5deg) skewX(10deg); box-shadow: -35px 35px 50px rgb(0,0, 0, 1); transition: 0.5s; /* 光標(biāo)呈現(xiàn)為指示鏈接的指針(一只手) */ cursor: pointer; } .book:hover{ /* rotate 定義 2D 旋轉(zhuǎn),在參數(shù)中規(guī)定角度。 */ /* skewX()定義沿著 X 軸的 2D 傾斜轉(zhuǎn)換。 translate(x,y) 定義 2D 轉(zhuǎn)換。 */ transform: rotate(-37.5deg) skewX(10deg) translate(20px,-20px); /* box-shadow 向框添加一個(gè)或多個(gè)陰影 */ box-shadow: -50px 50px 100px rgba(0,0,0,1); } /* 偽元素必須配合content進(jìn)行使用,至少為空 */ .book::before{ content:''; height:100%; width:30px; background: red; position: absolute; top: 0; left: 0; transform: skewY(-45deg) translate(-30px,-15px); box-shadow: inset -10px 0 20px raba(0,0,0,0,2); background: url(cofe.jpg); } .book::after{ content: ''; height: 30px; width: 100%; background: #fff; position: absolute; bottom: 0; left: 0; transform: skewX(-45deg) translate(15px,30px); background: url(cofe.jpg); } .book h2{ position: absolute; bottom: 100px; left: 10px; font-size: 5em; line-height: 1em; color: rgb(110, 21, 21); } .book h2 span{ background-image: url(cofe.jpg); background-attachment: fixed; -webkit-background-clip: text; -webkit-text-fill-color: transparent; } .book .write i{ font-weight: 700; } .book .cover{ position: absolute; top: 0; left: 0; width: 100%; height: 70%; background-image: url(cofe.jpg); background-size: cover; } </style> <body> <div class="book"> <div class="cover"></div> <h2>Book <span>javascript</span></h2> <span class="wirte"> written by fans</span> </div> </body> </html>
總結(jié)
到此這篇關(guān)于CSS實(shí)現(xiàn)3D書(shū)本效果的文章就介紹到這了,更多相關(guān)css 3D書(shū)本內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
純CSS3實(shí)現(xiàn)3D旋轉(zhuǎn)書(shū)本效果
有一些前沿的電商網(wǎng)站已經(jīng)開(kāi)始使用3D模型來(lái)展示商品并支持在線(xiàn)定制,而其中圖書(shū)的展示是最為簡(jiǎn)單的一種,無(wú)需復(fù)雜的建模過(guò)程,使用圖片和CSS3的一些變換即可實(shí)現(xiàn)更好的展示2016-03-21基于HTML5/CSS3實(shí)現(xiàn)的書(shū)本翻頁(yè)3D動(dòng)畫(huà)特效源碼 鼠標(biāo)滑過(guò)書(shū)本自動(dòng)翻頁(yè)
今天我們要分享一款基于HTML5和CSS3的書(shū)本翻頁(yè)3D動(dòng)畫(huà),當(dāng)我們將鼠標(biāo)滑過(guò)書(shū)本時(shí),書(shū)本就會(huì)自動(dòng)一頁(yè)頁(yè)翻過(guò)去,書(shū)本的3D效果非常不錯(cuò)2014-11-06