0%

前端css提升作业

前端课程

代码为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
* {
margin:0;
padding: 0;
}

li {
/* 取消小黑点*/
list-style: none;
}

.box {
position: relative;
width: 400px;
height: 200px;
border: 1px solid black;
margin: 30px 50px;
}

/* 设置图片的宽高和盒子一致*/
.pic img {
width:100%;
height: 200px;
}

/* 设置小圆点所在的外部边框*/
.btn {
position: absolute;
top:86%;
left:50%;
margin-left: -35px;
width: 75px;
height: 20px;
/*border: 1px solid red;*/

}

/* 小圆点*/
.btn li {
float: left;
width: 12px;
height: 10px;
border: 1px solid transparent;
border-radius: 50%;
background-color: darkgray;
margin:2px;
margin-top:4px;
/*vertical-align: middle;*/
}

/* 左右箭头*/
a {
text-decoration: none;
}

.prev,.next {
width: 18px;
height: 20px;
/*border: 1px solid red;*/
background-color: gainsboro;
position: absolute;
top:50%;
margin-top:-10px;
text-align: center;
line-height: 20px;
color:grey;
}

.prev {
left:0;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}

.next {
right:0;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;

}
</style>
</head>
<body>
<div class="box">
<!-- 背景图-->
<ul class="pic">
<li><img src="3.jpg" alt=""></li>
<li></li>
<li></li>
<li></li>
</ul>

<!-- 小圆点-->
<ul class="btn">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>

<!-- 左右箭头-->
<a href="#" class="prev">&lt;</a>
<a href="#" class="next">&gt;</a>
</div>
</body>
</html>