海报 demo
来源:互联网 发布:mac 压缩文件夹 编辑:程序博客网 时间:2024/04/29 22:41
效果
思路
1.设置两张图片和底部的搜索栏
<ul> <li> <img src="https://goo.gl/sGrO7g" alt=""> <div class="info"> <p>Drama</p> <div class="button"></div> </div> </li> <li> <img src="https://goo.gl/Cjq6Sj" alt=""> <div class="info"> <p>Action, Drama, Sci Fi</p> <div class="button"></div> </div> </li></ul>
2.设置图片的放大动画和阴影效果
li:hover img { cursor: pointer; box-shadow: 0 1em 2em rgba(0,0,0,0.2); transform: scale(1.1); }
3.设置搜索栏的下滑动画和阴影效果
li:hover .info { bottom: -4.75em; box-shadow: 0 1.5em 6em rgba(0,0,0,0.15); }
4.设置按钮的动画
.button:hover { cursor: pointer; background: lightslategray; } .button:hover::before { transform: translateX(-1.5em); opacity: 0; } .button:hover::after { transform: translateX(-1.5em); display: inline; opacity: 1; }
5.img、.info和.button都设置transition属性实现过渡动画
源码
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <style> body, ul, li { margin: 0; padding: 0; } ul { list-style: none; } body, ul, .info, .button { display: flex; flex-direction: row; } body { width: 100%; height: 100vh; background: rgb(240, 240, 240); justify-content: center; align-items: center; } li { position: relative; margin: 0 3em; transition: transform .5s, box-shadow .5s; } img { width: 300px; transition: transform .5s, box-shadow .5s; backface-visibility: hidden; } .info { z-index: -1; background: white; height: 5em; position: absolute; left: 0; right: 0; margin-left: auto; margin-right: auto; bottom: 5em; align-items: flex-end; justify-content: space-between; transition: bottom .6s, box-shadow .6s; } .info p { margin: 1.1em 1.25em; color: lightslategray; font-weight: 400; } .button { height: 3.75em; width: 6em; align-items: center; justify-content: center; background: tomato; color: white; transition: background .5s; } .button::before { content: "Watch"; transform:translateX(0.9em); transition: transform .5s, opacity .5s, display .5s; } .button::after { content: "Now"; opacity: 0; transform: translateX(1.5em); transition: transform .5s, opacity .5s, display .5s; } .button:hover { cursor: pointer; background: lightslategray; } .button:hover::before { transform: translateX(-1.5em); opacity: 0; } .button:hover::after { transform: translateX(-1.5em); display: inline; opacity: 1; } li:hover { transform: scale(1.1); } li:hover img { cursor: pointer; box-shadow: 0 1em 2em rgba(0,0,0,0.2); transform: scale(1.1); } li:hover .info { bottom: -4.75em; box-shadow: 0 1.5em 6em rgba(0,0,0,0.15); } </style></head><body><ul> <li> <img src="https://goo.gl/sGrO7g" alt=""> <div class="info"> <p>Drama</p> <div class="button"></div> </div> </li> <li> <img src="https://goo.gl/Cjq6Sj" alt=""> <div class="info"> <p>Action, Drama, Sci Fi</p> <div class="button"></div> </div> </li></ul></body></html>
参考
http://codepen.io/dhanishgajjar/pen/WjJJrg
阅读全文
1 0
- 海报 demo
- 海报
- [单调栈] BZOJ 1113 [Poi2008]海报PLA & BZOJ 1628 [Usaco2007 Demo]City skyline
- 海报详解
- 舞动海报
- 十大反日海报
- 十面埋伏各国海报
- 经典世界杯海报
- 历届世界杯海报
- 收集一个海报地址!
- 沐尔超酷海报系列之一
- AI SPACESHIP 宣传海报~~
- 激励人生的海报
- Silverlight 2 开发者海报
- 线段树;贴海报~
- .net 4.0海报
- 一张土耳其海报
- 母亲节主题宣传海报
- Cocos2dx 3.10使用using namespace CocosDenshion;错误提示,解决方法
- 高等数学引论》杂记(一)
- leetcode 371. Sum of Two Integers
- Spring动态代理的两种方式
- jQuery选择器和选取方法
- 海报 demo
- jQuery取得select选中的值
- 第一个servlet
- 组合数学杂记(一)
- Implement Trie (Prefix Tree)
- HDU1597 find the nth digit【模拟】
- C++PrimerPlus第十一章学习笔记——使用类
- JavaScript中typeof的用法汇总(返回的是变量类型)
- 我的大一