Enjoy the good life everyday!
关闭
欢迎来PyGo个人空间 ^_^
HTML+CSS+HR分割线 | PyGo²

HTML+CSS+HR分割线

推荐几款好看的hr标签分割线,也是网上找的,基于html与css,总结一下。


HTML

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<hr class="hr-grow-base hr-grow-trans hr-grow-hr1">
内容。。。。。。。。。。。。。。。。。。。。
<hr class="hr-grow-base hr-grow-trans hr-grow-hr2">
<hr class="hr-color-fade">
<hr class="hr-lean-line">
<hr class="hr-gray-fade">
<hr class="hr-grap-shadow">
<hr class="hr-dots">
<hr class="hr-accessory">
<hr class="hr-pill">
<hr class="hr-vertical-lines">
<hr class="hr-slash">
<hr class="hr-wave">
<hr class="hr-stars">

其中,关于Hr grow style样式需要说明一下,除了加上html与css之外,还需要加上js才会有动画效果。

1
2
3
setTimeout(function(){
$('.hr-grow-trans').addClass('hr-grow-add');
}, 275);

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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* Color fade */
.hr-color-fade {
width: 100%;
margin: 0 auto;
border: 0;
height: 4px;
background: #333;
background-image: linear-gradient(to right, red, #333, rgb(9, 206, 91));
}

/* Gray fade */
.hr-gray-fade {
width: 100%;
margin:0 auto;
border: 0;
height: 4px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}

/*Lean line*/
.hr-lean-line {
position: relative;
display: block;
margin-top: 4em;
margin-bottom: 4em;
height: 3px;
border:none;
background: linear-gradient(to right, transparent 50%, #fff 50%), linear-gradient(to right, #00b9ff, #59d941);
background-size: 1.5rem, 100%;
transform: rotate(-4.5deg);
transform-origin: 50% 0;
}

/*Grap-shadow*/
.hr-grap-shadow {
height: 10px;
border: 0;
box-shadow: 0 10px 10px -10px #3c3f41 inset;
}


/* Hr grow style
html:
<hr class="hr-grow-base hr-grow-trans hr-grow-hr1">
<hr class="hr-grow-base hr-grow-trans hr-grow-hr2">

js:
setTimeout(function(){
$('.hr-grow-trans').addClass('hr-grow-add');
}, 275);
*/

.hr-grow-base{
margin-top: 20px;
padding: 1.5px 0;
border: none;
/*background-color: rgb(250, 150, 0);*/
background-image: linear-gradient(to right, red, #333, rgb(9, 206, 91));
letter-spacing: 5px;
}
.hr-grow-hr1{
margin-left: 2%;
}
.hr-grow-hr2{
margin-right: 2%;
}
.hr-grow-trans{
-webkit-transition: width 1s ease-out;
transition: width 1s ease-out;
width : 0;
}
.hr-grow-add{
width: 96%;
}

/*Dots*/
.hr-dots{
color: orange;
border-width: 0 0 8px;
border-style: solid;
border-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2 1" width="8" height="4"><circle fill="orange" cx="1" cy="0.5" r="0.5"/></svg>') 0 0 100% repeat;
width: 90%;
}

/*accessory*/
.hr-accessory {
height: 6px;
background-image: radial-gradient(closest-side, gray, rgba(128, 128, 128, 0) 100%);
position: relative;
}

.hr-accessory:after {
position: absolute;
top: 50%;
left: 50%;
display: block;
background-color: #bfbfbf;
height: 12px;
width: 12px;
transform: rotate(45deg);
margin-top: -10px;
margin-left: -10px;
border-radius: 4px 0;
border: 4px solid rgba(255, 255, 255, 0.35);
background-clip: padding-box;
box-shadow: -10px 10px 0 rgba(255, 255, 255, 0.15), 10px -10px 0 rgba(255, 255, 255, 0.15);
}


/*pill*/
.hr-pill {
height: 1rem;
border-radius: 1rem;
color: teal;
background-color: #00FFFF;
border: 2px solid currentColor;
width: 80%;
}


/*vertical-lines*/
.hr-vertical-lines {
height: 1rem;
color: orange;
background-image: linear-gradient(90deg, currentColor, currentColor 33.33%, transparent 33.33%, transparent 100%);
background-size: 3px 100%;
width: 80%;
}

/*slash*/
.hr-slash {
height: 10px;
background-image: linear-gradient(45deg, rgba(13, 13, 13, 0), rgba(13, 13, 13, 0) 33.33%, #0d0d0d 33.33%, #0d0d0d 66.67%, rgba(13, 13, 13, 0) 66.67%, rgba(13, 13, 13, 0) 100%);
background-size: 10px 100%;
width: 90%;
}


/* Wave */
.hr-wave {
width: 96%;
border-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 15" width="12" height="15"><path fill="none" stroke="rgba(191, 191, 191, 0.9)" stroke-width="3" d="M0,13.5c3,0,3-12,6-12s3,12,6,12"/></svg>') 0 0 100% repeat;
border-width: 0 0 0.8rem;
border-style: solid;
}

/* stars */
.hr-stars {
border: 0;
height: auto;
color: gold;
text-align: center;
}
.hr-stars:after {
content: "★";
font-size: 1em;
text-shadow: -6em 0, -5em 0, -4em 0, -3em 0, -2em 0, -1em 0, 1em 0, 2em 0, 3em 0, 4em 0, 5em 0, 6em 0;
}
  • 本文作者:mingliang.gao【一个爱老婆Python程序猿。。。。。。】
  • 本文链接: http://pygo2.top/articles/50666/
  • 版权声明: 本博客所有文章欢迎转载,转载请注明出处!
觉得有帮助 请偶坐个公交车
0%