Infinite Tags Scroll html code for free
index.html
1<!DOCTYPE html>
2<html>
3<head>
4 <title>Infinite Scroll</title>
5 <link rel="stylesheet" href="/css/styles.css">
6</head>
7<body>
8 <div class="scroller" data-speed="fast">
9 <ul class="tag-list scroller__inner">
10 <li>HTML Templates</li>
11 <li>CSS Login Forms</li>
12 <li>JS</li>
13 <li>SSG</li>
14 <li>webdev</li>
15 <li>animation</li>
16 <li>UI/UX</li>
17 <li>SSG</li>
18 <li>webdev</li>
19 <li>animation</li>
20 <li>UI/UX</li>
21 </ul>
22 </div>
23 <script src="/js/main.js"></script>
24</body>
25</html>
26
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<title>Infinite Scroll</title>
5
<link rel="stylesheet" href="/css/styles.css">
6
</head>
7
<body>
8
<div class="scroller" data-speed="fast">
9
<ul class="tag-list scroller__inner">
10
<li>HTML Templates</li>
11
<li>CSS Login Forms</li>
12
<li>JS</li>
13
<li>SSG</li>
14
<li>webdev</li>
15
<li>animation</li>
16
<li>UI/UX</li>
17
<li>SSG</li>
18
<li>webdev</li>
19
<li>animation</li>
20
<li>UI/UX</li>
21
</ul>
22
</div>
23
<script src="/js/main.js"></script>
24
</body>
25
</html>
26
styles.css
1.scroller {
2 max-width: 900px;
3 }
4
5 .scroller__inner {
6 padding-block: 1rem;
7 display: flex;
8 flex-wrap: wrap;
9 gap: 1rem;
10 }
11
12 .scroller[data-animated="true"] {
13 overflow: hidden;
14 -webkit-mask: linear-gradient(
15 90deg,
16 transparent,
17 white 20%,
18 white 80%,
19 transparent
20 );
21 mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
22 }
23
24 .scroller[data-animated="true"] .scroller__inner {
25 width: max-content;
26 flex-wrap: nowrap;
27 animation: scroll var(--_animation-duration, 40s)
28 var(--_animation-direction, forwards) linear infinite;
29 }
30
31
32 .scroller[data-direction="left"] {
33 --_animation-direction: forwards;
34 }
35
36 .scroller[data-speed="fast"] {
37 --_animation-duration: 40s;
38 }
39
40
41 @keyframes scroll {
42 to {
43 transform: translate(calc(-50% - 0.5rem));
44 }
45 }
46
47 html {
48 color-scheme: dark;
49 }
50
51 body {
52 display: grid;
53 min-block-size: 100vh;
54 place-content: center;
55 font-family: system-ui;
56 font-size: 1.125rem;
57 }
58
59 .tag-list {
60 margin: 0;
61 padding-inline: 0;
62 list-style: none;
63 }
64
65 .tag-list li {
66 padding: 1rem;
67 background-color: transparent;
68 border: 1px solid #eceff133;
69 border-radius: 0.5rem;
70 }
71
72
1
.scroller {
2
max-width: 900px;
3
}
4
5
.scroller__inner {
6
padding-block: 1rem;
7
display: flex;
8
flex-wrap: wrap;
9
gap: 1rem;
10
}
11
12
.scroller[data-animated="true"] {
13
overflow: hidden;
14
-webkit-mask: linear-gradient(
15
90deg,
16
transparent,
17
white 20%,
18
white 80%,
19
transparent
20
);
21
mask: linear-gradient(90deg, transparent, white 20%, white 80%, transparent);
22
}
23
24
.scroller[data-animated="true"] .scroller__inner {
25
width: max-content;
26
flex-wrap: nowrap;
27
animation: scroll var(--_animation-duration, 40s)
28
var(--_animation-direction, forwards) linear infinite;
29
}
30
31
32
.scroller[data-direction="left"] {
33
--_animation-direction: forwards;
34
}
35
36
.scroller[data-speed="fast"] {
37
--_animation-duration: 40s;
38
}
39
40
41
@keyframes scroll {
42
to {
43
transform: translate(calc(-50% - 0.5rem));
44
}
45
}
46
47
html {
48
color-scheme: dark;
49
}
50
51
body {
52
display: grid;
53
min-block-size: 100vh;
54
place-content: center;
55
font-family: system-ui;
56
font-size: 1.125rem;
57
}
58
59
.tag-list {
60
margin: 0;
61
padding-inline: 0;
62
list-style: none;
63
}
64
65
.tag-list li {
66
padding: 1rem;
67
background-color: transparent;
68
border: 1px solid #eceff133;
69
border-radius: 0.5rem;
70
}
71
72
main.js
1const scrollers = document.querySelectorAll(".scroller");
2 addAnimation();
3
4function addAnimation() {
5 scrollers.forEach((scroller) => {
6 scroller.setAttribute("data-animated", true);
7
8 const scrollerInner = scroller.querySelector(".scroller__inner");
9 const scrollerContent = Array.from(scrollerInner.children);
10 scrollerContent.forEach((item) => {
11 const duplicatedItem = item.cloneNode(true);
12 duplicatedItem.setAttribute("aria-hidden", true);
13 scrollerInner.appendChild(duplicatedItem);
14 });
15 });
16}
17
1
const scrollers = document.querySelectorAll(".scroller");
2
addAnimation();
3
4
function addAnimation() {
5
scrollers.forEach((scroller) => {
6
scroller.setAttribute("data-animated", true);
7
8
const scrollerInner = scroller.querySelector(".scroller__inner");
9
const scrollerContent = Array.from(scrollerInner.children);
10
scrollerContent.forEach((item) => {
11
const duplicatedItem = item.cloneNode(true);
12
duplicatedItem.setAttribute("aria-hidden", true);
13
scrollerInner.appendChild(duplicatedItem);
14
});
15
});
16
}
17