Skip to content

Instantly share code, notes, and snippets.

@koolamusic
Last active February 12, 2022 20:32
Show Gist options
  • Save koolamusic/caeaa37642b974ab981a560c1f84c91d to your computer and use it in GitHub Desktop.
Save koolamusic/caeaa37642b974ab981a560c1f84c91d to your computer and use it in GitHub Desktop.
Horizontal Scroll
const HorizontalScroll = styled.div`
position: relative;
overflow: hidden;
--offset: 20vw;
--move-initial: calc(-25% + var(--offset));
--move-final: calc(-50% + var(--offset));
div {
width: fit-content;
display: flex;
position: relative;
transform: translate3d(var(--move-initial), 0, 0);
animation: marquee 5s linear infinite;
animation-play-state: paused;
}
@keyframes {
0% {
transform: translate3d(var(--move-initial), 0, 0);
}
100% {
transform: translate3d(var(--move-final), 0, 0);
}
}
`
<HorizontalScroll>
<div>
Insert the Content you want to scroll
</div>
</HorizontalScroll>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment