Pure CSS3 List Panel Hover Effect

Add-ons
2026-07-26 07:16 8 次浏览 • 0 次下载 5.3KB
Pure CSS3 List Panel Hover Effect

Implementation

HTML Structure

The HTML structure of this list panel is as follows: Use a <div> element to wrap a group of ordered list elements.

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
<div class="leaderboard">
<h1>
<svg class="ico-cup">
<use xlink:href="#cup"></use>
</svg>
Most active Players
</h1>
<ol>
<li>
<mark>Jerry Wood</mark>
<small>315</small>
</li>
<li>
<mark>Brandon Barnes</mark>
<small>301</small>
</li>
<li>
<mark>Raymond Knight</mark>
<small>292</small>
</li>
<li>
<mark>Trevor McCormick</mark>
<small>245</small>
</li>
<li>
<mark>Andrew Fox</mark>
<small>203</small>
</li>
</ol>
</div>
</div>

CSS Styles

The ribbon effect for list items is created using the list item'slipseudo-element.:beforeand:afterTheir opacity is set toopacity0 by default.

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
.leaderboard ol li mark {
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 18px 10px 18px 50px;
margin: 0;
background: none;
color: #fff;
}
.leaderboard ol li mark::before, .leaderboard ol li mark::after {
content: '';
position: absolute;
z-index: 1;
bottom: -11px;
left: -9px;
border-top: 10px solid #c24448;
border-left: 10px solid transparent;
-webkit-transition: all .1s ease-in-out;
transition: all .1s ease-in-out;
opacity: 0;
}
.leaderboard ol li mark::after {
left: auto;
right: -9px;
border-left: none;
border-right: 10px solid transparent;
}
.leaderboard ol li small {
position: relative;
z-index: 2;
display: block;
text-align: right;
}
.leaderboard ol li::after {
content: '';
position: absolute;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #fa6855;
box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
-webkit-transition: all .3s ease-in-out;
transition: all .3s ease-in-out;
opacity: 0;
}
When the mouse hovers over a list item, the ribbon's opacity is set to1,。
.leaderboard ol li:hover::after {
opacity: 1;
-webkit-transform: scaleX(1.06) scaleY(1.03);
transform: scaleX(1.06) scaleY(1.03);
}
.leaderboard ol li:hover mark::before, .leaderboard ol li:hover mark::after {
opacity: 1;
-webkit-transition: all .35s ease-in-out;
transition: all .35s ease-in-out;
}

For the complete CSS code, please refer to the downloaded files.


星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare