Skip to content

Commit e15baf5

Browse files
committed
css实现时间轴效果
1 parent db33ac3 commit e15baf5

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>时间轴效果</title>
6+
<style>
7+
body {
8+
margin: 0;
9+
background-image: linear-gradient(to right, #fdf1d8, #b1bbf9);
10+
}
11+
h3 {
12+
margin: 0;
13+
font-weight: 400;
14+
}
15+
.clearfix::after {
16+
content: "";
17+
display: block;
18+
clear: both;
19+
}
20+
.time-axis {
21+
width: 804px;
22+
margin: 50px auto 0;
23+
}
24+
.time-axis .left {
25+
width: 400px;
26+
float: left;
27+
border-right: 4px solid #b1bbf9;
28+
position: relative;
29+
}
30+
.time-axis .right {
31+
width: 400px;
32+
float: right;
33+
border-left: 4px solid #b1bbf9;
34+
position: relative;
35+
}
36+
.time-axis .dot {
37+
width: 10px;
38+
height: 10px;
39+
background-color: #fff;
40+
display: block;
41+
border: 2px solid #b1bbf9;
42+
border-radius: 7px;
43+
position: absolute;
44+
top: 50%;
45+
margin-top: -7px;
46+
}
47+
.time-axis .left .dot {
48+
right: -9px;
49+
}
50+
.time-axis .right .dot {
51+
left: -9px;
52+
}
53+
.time-axis .jiantou {
54+
width: 32px;
55+
height: 32px;
56+
display: block;
57+
position: absolute;
58+
top: 50%;
59+
margin-top: -16px;
60+
}
61+
.time-axis .left .jiantou {
62+
right: 0;
63+
/*background: url();*/
64+
}
65+
.time-axis .right .jiantou {
66+
left: 0;
67+
/*background: url();*/
68+
}
69+
.time-axis .con {
70+
background-color: #fff;
71+
padding: 15px;
72+
border-radius: 10px;
73+
text-align: center;
74+
}
75+
.time-axis .left .con {
76+
margin-right: 22px;
77+
}
78+
.time-axis .right .con {
79+
margin-right: 22px;
80+
}
81+
</style>
82+
</head>
83+
<body>
84+
<div class="time-axis clearfix">
85+
<div class="left">
86+
<span class="dot"></span>
87+
<span class="jiantou"></span>
88+
<div class="con">
89+
<h3>时间轴内容在这里可以随便布局</h3>
90+
</div>
91+
</div>
92+
<div class="right">
93+
<span class="dot"></span>
94+
<span class="jiantou"></span>
95+
<div class="con">
96+
<h3>时间轴内容在这里可以随便布局</h3>
97+
</div>
98+
</div>
99+
</div>
100+
</body>
101+
</html>

0 commit comments

Comments
 (0)