HTML;css;js前端动态开发——图片轮播,包括自动播放和手动选择,左右按钮和滑点选择,鼠标暂停
样式如图:
代码如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>轮播图的实现</title>
</head>
<style>
* {
box-sizing: border-box;/*border-box 告诉浏览器去理解你设置的边框和内边距的值是包含在width内的。
也就是说,如果你将一个元素的width设为100px,那么这100px会包含其它的border和padding,
内容区的实际宽度会是width减去border + padding的计算值。大多数情况下这使得我们更容易的去设定一个元素的宽高。*/
padding: 0;
margin: 0;
}
body {
background-color: gray;
}
div {
width: 550px;
height: 300px;
margin: 100px auto;
position: relative;
}
ul {
list-style: none;
}
.images li {
position: absolute;
opacity: 0;
transition: 0.6s;
}
.images .active {
opacity: 1;
}
.images img {
width: 550px;
height: 300px;
cursor: pointer;
}
/*设置一排小圆点的位置*/
.dots {
position: absolute;
bottom: 20px;
left: 190px;
}
/*设置每个小圆点的形状等*/
.dots li {
width: 22px;
height: 22px;
border-radius: 50%;
border: solid 2px #fff;
display: inline-block;
margin-right: 10px;
padding-left: