Created
June 2, 2026 22:56
-
-
Save dsmy/8b337ff1dc669ea9dcb029a9cc1330c2 to your computer and use it in GitHub Desktop.
Books Hover Animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="container"> | |
| <div class="box-inner"> | |
| <div class="book books-1 book-blur"></div> | |
| <div class="book books-2 book-blur"></div> | |
| <div class="book books-3 book-blur"></div> | |
| </div> | |
| <div class="box-out"> | |
| <div class="book books-1"></div> | |
| <div class="book books-2"></div> | |
| <div class="book books-3"></div> | |
| </div> | |
| </div> | |
| <a href="https://dribbble.com/YancyMin" class="dr-url" target="_blank"><img class="dr" src="https://cdn.dribbble.com/assets/logo-footer-hd-a05db77841b4b27c0bf23ec1378e97c988190dfe7d26e32e1faea7269f9e001b.png" alt=""></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body, | |
| ol, | |
| ul, | |
| h1, | |
| h2, | |
| h3, | |
| h4, | |
| h5, | |
| h6, | |
| p, | |
| th, | |
| td, | |
| dl, | |
| dd, | |
| form, | |
| fieldset, | |
| legend, | |
| input, | |
| textarea, | |
| i, | |
| select { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| body { | |
| height: 100%; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| } | |
| .container { | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| width: 100vw; | |
| } | |
| .box-out { | |
| z-index: -99; | |
| width: 720px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| position: absolute; | |
| top: 140px; | |
| } | |
| .box-inner { | |
| /* display: none; */ | |
| z-index: 99; | |
| width: 900px; | |
| display: flex; | |
| /* justify-content: space-between; */ | |
| align-items: center; | |
| position: absolute; | |
| top: 350px; | |
| overflow: hidden; | |
| background-color: #fff; | |
| } | |
| .book { | |
| width: 180px; | |
| height: 255px; | |
| background-color: rgb(62, 71, 152); | |
| transition: all .3s ease-in-out; | |
| transform-origin: left center 0px; | |
| transform-style: preserve-3d; | |
| border-top-right-radius: 5px; | |
| border-bottom-right-radius: 5px; | |
| -webkit-backface-visibility: hidden; | |
| overflow: hidden; | |
| } | |
| .box-out .book::after { | |
| content: " "; | |
| display: block; | |
| opacity: 0; | |
| width: 180px; | |
| height: 255px; | |
| position: relative; | |
| left: 8px; | |
| transition: all .3s ease; | |
| } | |
| .box-out .book::before { | |
| content: " "; | |
| z-index: 999; | |
| display: block; | |
| width: 20px; | |
| height: 100px; | |
| opacity: 0; | |
| position: absolute; | |
| top: -12px; | |
| right: 8px; | |
| transition: all .25s; | |
| background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD8AAABhCAYAAABh23lYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHCSURBVHgB7dxPTsJAHMXxN7Xu3UhigobxJHACvQFwAr2BcgO8AZxE7uGiDZiQyEIW7oSOUyKbKgLS8u+9b9JNF818fum0XdWUhy9VEDZBGIdBGD6DsFM3bQYgTnjWhGdNeNaEZ0141oRnTXjWhGdNeNaEZ0141oRnTXjWhGdNeNaEZ0141oRnTXjWhGdNeNaEZ0141oRnTXjWhGdNeNaEZ0141oRnTXjWhGdNeNaEZ0141oRnTXjWhGdNeNZ2hR/7o+UcmnCIsaNCbLcU/RR8oB1bO/4+17l8ixoGeIBBBVvMXI0ih+L7Df2j8iiqnvgh+AVVUXDOTZvF4tNb2qC7DJ1tNgSDO78tblFQxeE92l+0NSjZDjaoMowqyYl7hDF15JzL+x+YHtxLgFq/ZO2m8LT4wsb90nUjmMD61XaRc7ng5+jBua29ntsecq6oIWyELxqdLe8h/GvPp+h0T28D/FezZ8Ip7pHgZt3X5NoPvH1BZ5sNIUTDL7C+6hBWxxt0gk+00tsOe96qH0zL8GO4pBtMg/YhoLMtG8Ii/EpfY4fSoiFk8UeFzpYdwhz/jiNGZ0uHEBjUEzftohJFZyAsdX8BM0/amLC3spYAAAAASUVORK5CYII='); | |
| background-size: 16px; | |
| background-repeat: no-repeat; | |
| } | |
| /*------ background-pic ------*/ | |
| .books-1 { | |
| background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/945546/3433202-d2a1bea8a58cd447.png'); | |
| background-size: 180px 255px; | |
| } | |
| .books-2 { | |
| background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/945546/3433202-6b51313cfc447314.png'); | |
| background-size: 180px 255px; | |
| } | |
| .books-3 { | |
| background: url('https://upload-images.jianshu.io/upload_images/3433202-564e196e8b409f16.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240'); | |
| background-size: 180px 255px; | |
| } | |
| /* ----- book-blur ----- */ | |
| .book-blur { | |
| filter: blur(30px) | |
| } | |
| .box-inner .book { | |
| margin-left: 90px; | |
| position: relative; | |
| top: -194px; | |
| } | |
| /* ----- hover ----- */ | |
| .book:hover { | |
| cursor: pointer; | |
| transform: rotateY(-28deg) rotateZ(-2deg) scale(1.02); | |
| -webkit-backface-visibility: hidden; | |
| box-shadow: 1px 3px 2px #353d85, 20px 8px 0 #525dc4; | |
| /* transform: scale(1.02); */ | |
| } | |
| .book:hover::after { | |
| content: " "; | |
| display: block; | |
| opacity: 1; | |
| width: 172px; | |
| height: 255px; | |
| position: relative; | |
| left: 8px; | |
| background: linear-gradient(-180deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, 0) 60%); | |
| } | |
| .book:hover::before { | |
| transform: translateY(9px); | |
| opacity: 1; | |
| } | |
| .dr { | |
| position: absolute; | |
| bottom: 16px; | |
| right: 16px; | |
| width:100px; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment