轮播图CSS
css3中的animation:动画名 持续时间 动画的速度曲线 动画开始之前的延迟 动画播放的次数 是否应该轮流反向播放动画
动画播放次数:n(定义应该播放多少次动画) ; infinite(无限循环)
动画延迟:ns (默认为零)
是否反向播放: normal alterna
动画的速度曲线; linear (匀速);ease(默认 先快然后加速,最后变慢);ease-in(以低速开始);ease-out(以低速结束);ease-in-out(动画一低速开始和结束)
cubic-bezier(n,n,n,n)
@keyframes(用来改变动画轨迹或者效果)和animate
1需要创建一个名字,后面绑定动画时需要
2.from 起始时0%
3 to到达终点时等同于100%
box-sizing属性:content-box(border和padding值不计算在width之内);padding-box(padding计算在width之内);border-box(border和padding计算在width之内)
content属性:
a:after
{
content: " (" attr(href) ")";
}
HTML:
<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>轮播图</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="main">
<div class="imgs">
<a href="javascript:void(0);" class="first-img"><img src="img/img1.jpg"></a>
<a href="javascript:void(0);"><img src="img/img2.jpg"></a>
<a href="javascript:void(0);"><img src="img/img3.jpg"></a>
<a href="javascript:void(0);"><img src="img/img4.jpg"></a>
<a href="javascript:void(0);"><img src="img/img5.jpg"></a>
</div> <div class="controller">
<div class="show-static"></div>
<div class="show-run"></div>
<a class="controller-tag1" href="javascript:void(0);"><img src="img/img1.jpg"></a>
<a class="controller-tag2" href="javascript:void(0);"><img src="img/img2.jpg"></a>
<a class="controller-tag3" href="javascript:void(0);"><img src="img/img3.jpg"></a>
<a class="controller-tag4" href="javascript:void(0);"><img src="img/img4.jpg"></a>
<a class="controller-tag5" href="javascript:void(0);"><img src="img/img5.jpg"></a> </div> </body>
</html> CSS:
* {
margin: 0;
padding: 0;
}
.main {
position: relative;
width: 1200px;
margin: 50px auto;
border: solid 1px #ccc;
}
.imgs {
position: relative;
width: 100%;
height: 600px;
overflow: hidden;
}
.main a {
display: block;
width: 100%;
height: 100%;
}
.imgs a:first-child{
animation: imgAnimate 18s linear infinite alternate;
}
.imgs:hover > .first-img,
.imgs:hover + .controller .show-run {
animation-play-state: paused;
}
.imgs a img {
width: 100%;
height: 100%;
}
.controller {
position: absolute;
top: 0px;
right: 0px;
left: 0px;
bottom: 0px;
width: 80%;
height: 40px;
margin: 0 auto;
margin-top: 560px;
}
.controller .show-run {
margin-bottom: -17px;
height: 16px;
width: 20%;
background: #FDB024;
animation: showAnimate 18s linear infinite alternate;
}
.controller .show-static {
margin-bottom: -17px;
height: 17px;
width: 100%;
background: #575757;
}
.controller a {
display: block;
box-sizing: border-box;
float: left;
width: 20%;
height: 17px;
margin: 0px;
border: solid 1px #CCC;
}
.controller a img {
display: none;
box-sizing: border-box;
width: 100%;
height: 150px;
margin-top: -160px;
border: solid 1px #FDB024;
}
.controller a::after {
position: relative;
content: "";
display: none;
margin-left: -20px;
left: 50%;
width: 10px;
height: 0px;
border-left:20px solid transparent;
border-right:20px solid transparent;
border-top: solid 10px #FDB024;
}
.controller-tag1:hover > img,
.controller-tag1:hover::after{
display: block;
}
.controller-tag2:hover > img,
.controller-tag2:hover::after{
display: block;
}
.controller-tag3:hover > img,
.controller-tag3:hover::after{
display: block;
}
.controller-tag4:hover > img,
.controller-tag4:hover::after{
display: block;
}
.controller-tag5:hover > img,
.controller-tag5:hover::after{
display: block;
}
@keyframes imgAnimate
{
0% {
margin-top: 0px;
}
11.11% {
margin-top: 0px;
}
22.22% {
margin-top: -600px;
}
33.33% {
margin-top: -600px;
}
44.44% {
margin-top: -1200px;
}
55.55% {
margin-top: -1200px;
}
66.66% {
margin-top: -1800px;
}
77.77% {
margin-top: -1800px;
}
88.88% {
margin-top: -2400px;
}
100% {
margin-top: -2400px;
}
}
@keyframes showAnimate
{
0% {
margin-left: 0px;
}
11.11% {
margin-left: 0px;
}
22.22% {
margin-left: 20%;
}
33.33% {
margin-left: 20%;
}
44.44% {
margin-left: 40%;
}
55.55% {
margin-left: 40%;
}
66.66% {
margin-left: 60%;
}
77.77% {
margin-left: 60%;
}
88.88% {
margin-left: 80%;
}
100% {
margin-left: 80%;
}
}
轮播图CSS的更多相关文章
- 用js和jQuery做轮播图
Javascript或jQuery做轮播图 css样式 <style> a{ text-decoration:none; } .naver{ width: 100%; position:r ...
- 用 CSS 做轮播图
对于用 css 实现一个轮播图的缘由,是那时候刚开始接触前端,完全还不懂 js.但是有一个项目(就是一个用来应付面试的作品)需要做一个轮播的效果,当时第一反应就是用 css3 自定义动画 -webki ...
- 基于css制作轮播图的部分效果
在轮播图中,我们可以通过鼠标在特定位置上的滑动来实现元素背景的改变.通常在制作轮播图时,我们首先想到的是js中的交互.可是,如果我们无法使用js,只能单纯的靠css又该如何实现这一效果呢?下面,本人将 ...
- jquery里面的attr和css来设置轮播图竟然效果不一致
/*封装$*/ // window.$=HTMLElement.prototype.$=function(selector){ // var elems=(this==window?document: ...
- html、css、js实现轮播图
2017-03-13 今天把轮播图的知识1过了一下,写了一个比较简单的轮播图,给大家参考一下. 查看具体的效果点击这个链接 : http://gjhnstxu.me/%E8%BD%AE%E6%92%A ...
- css动画属性--轮播图效果
通过css的动画属性实现轮播图的显示效果 代码如下: 主体部分: <div id="move"> <ul> <li><img src=&q ...
- 用html +js+css 实现页面轮播图效果
html 页面 <html lang="en"> <head> <meta charset="UTF-8"> <met ...
- css3 - 纯css实现一个轮播图
这是我上一次的面试题.一晃两个月过去了. 从前都是拿原理骗人,把怎么实现的思路说出来. 我今天又被人问到了,才想起来真正码出来.码出来效果说明一切: 以上gif,只用到了5张图片,一个html+css ...
- 纯HTML和CSS实现JD轮播图
博主使用了纯HTML和CSS实现了JD的轮播图,没有加动态效果,主要是使用了定位的知识. ,如图为两个侧边箭头图片(其实实际中应该使用CSS3的图标字体,这里没有使用). <!DOCTYPE ...
随机推荐
- Gym - 101981E 思维
Gym - 101981EEva and Euro coins 题意:给你两个长度皆为n的01串s和t,能做的操作是把连续k个相同的字符反转过来,问s串能不能变成t串. 一开始把相同的漏看了,便以为是 ...
- HDU4254 A Famous Game
luogu嘟嘟嘟 这题刚开始特别容易理解错:直接枚举所有\(n + 1\)种情况,然后算哪一种情况合法,再统计答案. 上述思想的问题就在于我们从已知的结果出发,默认这种每一种情况中取出\(q\)个红球 ...
- eclipse 点击 new window 后,关闭新增的窗口
点击右上角的 X 关闭,不要点击 exit 退出
- Python测试框架对比
如有任何学习问题,可以添加作者微信:lockingfree 更多学习资料请加QQ群: 822601020获取 unittest, pytest, nose, robot framework对比 什么是 ...
- 如果对方网站反爬取,封IP了怎么办?
放慢抓取熟速度,减小对目标网站造成的压力,但是这样会减少单位时间内的数据抓取量 使用代理IP(免费的可能不稳定,收费的可能不划算)
- 20191024-6 Alpha发布用户使用报告
此作业要求参见:https://edu.cnblogs.com/campus/nenu/2019fall/homework/9863 组名:胜利点 组长:贺敬文 组员:彭思雨 杨萍 王志文 位军 ...
- IDEA 同时打开多个项目
打开IDEA Settings-->System Settings-->Open project in new wodow
- The implementation of iterators in C# and its consequences (part 1) Raymond Chen
Likeanonymous methods, iterators in C# are very complex syntactic sugar. You could do it all yoursel ...
- CV3——学习笔记-续
使用Jupyter.https://jupyter.org/install https://baijiahao.baidu.com/s?id=1601883438842526311&wfr=s ...
- nginx里面的location 规则匹配
nginx location语法 ~ # 区分大小写的正则匹配 location ~ \.(gif|jpg|png|js|css)$ { #规则D } ~* # 不区分大小写的正则匹配(和~的功能相同 ...