Squiggly Path Scroll Indicator Using Pure CSS

Squiggly Path Scroll Indicator Using Pure CSS
Code Snippet:Pure CSS squiggly path scroll indicator
Author: Amit
Published: March 21, 2024
Last Updated: March 21, 2024
Downloads: 245
License: MIT
Edit Code online: View on CodePen
Read More

This code creates a squiggly path scroll indicator using pure CSS. The indicator follows a predefined path as you scroll. It helps users track their scrolling progress on the page.

You can use this code on your website to enhance user experience. It provides a visually engaging way for users to track their progress while scrolling. Additionally, it adds a modern and dynamic element to your website design.

How to Create Squiggly Path Scroll Indicator Using Pure CSS

1. First, create the necessary HTML structure for your webpage. You’ll need a container element to hold the scroll indicator, along with any other content you want to display.

<div class="path-cont">
  <svg class="svgpath" preserveAspectRatio="none" viewbox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
    <path fill="none" stroke-dasharray="5,3" stroke="#0070f3" d="M51,0 L61,7 L69,12 L74,18 L72,25 L62,29 L45,32 L29,32 L13,26 L20,19 L37,15 L56,15 L68,17 L80,24 L82 31 L76,37 L67,43 L57,49 L44,55 L35,60 L26,66 L25,70 L30,75 L36,81 L46,86 L55,91 L65,96 L72,99"></path>
  <div class="obj"></div>
<div class="big-thing"> 
  <h1>Scroll Onwards</h1>
  <p> <strong>Sadly no love in firefox and safari yet for animation timeline, have to wait on such implementations.</strong></p>
  <p> </p><a href="https://codepen.io/ghaste/pen/PoVWgZp" target="_blank">SVG path </a>based offset-path does not support responsive design, which is another draw-back.
  <p>You can use a <strong>polygon path</strong>, which is responsive, but you will then have to create that visible path yourself (intentionally terrible job here). It will not be a smooth path as shown here.</p>
  <p>I found that the <a href="https://bennettfeely.com/clippy/" target="_blank">Clippy</a> - clip-path generator 
    can be used for generating the polygon.
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tristique sit amet erat vitae ultrices. Proin ultrices, velit a gravida convallis, orci neque aliquet quam, ac aliquam odio dolor sit amet est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed faucibus magna ac lorem pellentesque tincidunt. Cras eu sem sit amet orci tincidunt convallis. Aliquam faucibus blandit porttitor. Donec efficitur in quam vitae blandit. Sed sed dui mi. Integer euismod enim quis gravida pretium. Curabitur sed lacus nec nulla tristique tincidunt ut id ex. Aenean dignissim lorem sit amet neque vulputate, vel consequat magna mattis. Integer et volutpat orci. Sed vehicula, nisl vel dignissim feugiat, eros risus condimentum neque, et lacinia est purus sed sem. Mauris sagittis ultricies dolor.</p>
  <p>Sed nec neque tempus, vulputate ligula sit amet, euismod orci. Nunc cursus quam a pharetra sagittis. Donec quis diam vel quam feugiat laoreet. Ut lobortis semper turpis, vitae fermentum tortor scelerisque pharetra. Nullam aliquet ipsum a condimentum bibendum. Integer ac purus mi. Nam rutrum orci vitae feugiat luctus. Quisque sodales, nisi eu accumsan sodales, nisl metus semper nisl, non fringilla turpis quam a tortor. Aenean posuere nisl vitae felis fermentum congue.</p>
  <p>Integer imperdiet ligula tristique, tincidunt augue in, congue elit. Etiam elementum nec urna nec tincidunt. Fusce arcu nisl, rhoncus non dignissim vel, venenatis at augue. In auctor eu nisl et imperdiet. Duis imperdiet vehicula est, ac convallis urna hendrerit et. Sed pulvinar nunc eu enim placerat, eget lobortis libero laoreet. Donec et mollis metus. Nunc leo magna, dignissim eu neque hendrerit, commodo varius lacus. Morbi pretium, augue vel commodo convallis, felis nisi tincidunt mauris, sed scelerisque massa quam ut ipsum. Sed pellentesque nisl ut dapibus condimentum. Quisque nec dapibus ante. Mauris ac accumsan augue. Donec tincidunt est imperdiet augue ultricies finibus. Vivamus volutpat egestas tellus a malesuada.</p>
  <p>Duis at velit bibendum ligula accumsan tempor vel ac justo. Ut rutrum lectus vel tristique maximus. Cras vitae nibh sit amet justo mattis porta in sit amet tellus. Aenean vitae nunc elementum, auctor arcu in, hendrerit ligula. Pellentesque nec vehicula sapien. Suspendisse ac metus consectetur, gravida ante quis, suscipit mauris. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam tincidunt venenatis tristique. Pellentesque tristique lectus nunc, ac gravida ante scelerisque nec. Nullam a libero sit amet ipsum malesuada porttitor.</p>

2. Next, add CSS styles to create the squiggly path scroll indicator and style your webpage as desired. Customize the CSS code to match the design and styling of your website. You can adjust colors, sizes, and animations to suit your preferences.

@import url("https://fonts.googleapis.com/css2?family=Architects+Daughter&family=Roboto:wght@100;400&display=swap");

.path-cont {
  position: fixed;
  width: 20vw;
  height: 100vh;
  top: 0;
  left: 0;
  pointer-events: none;
  color: #FBF7F490;
  z-index: 10;
   background: #1f2020 

.svgpath {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
.svgpath path {
  stroke: #FBF7F430;

.obj {
  position: absolute;
  offset-path: polygon(51% 0%, 61% 7%, 69% 12%, 74% 18%, 72% 25%, 62% 29%, 45% 32%, 29% 32%, 13% 26%, 20% 19%, 37% 15%, 56% 15%, 68% 17%, 80% 24%, 82% 31%, 76% 37%, 67% 43%, 57% 49%, 44% 55%, 35% 60%, 26% 66%, 25% 70%, 30% 75%, 36% 81%, 46% 86%, 55% 91%, 65% 96%, 72% 99%);
  animation: followpath linear;
  animation-timeline: scroll();

@keyframes followpath {
  from {
    offset-distance: 2%;
  to {
    offset-distance: 60%;
body {
  background-color: #1f2020;
  color: #FBF7F4;
  font-family: Roboto, sans-serif;
  font-weight: 100;

h1 {
  font-family: "Architects Daughter", cursive;
  font-size: clamp(2rem, 8vw + 1rem, 10rem);
  line-height: 1;
  margin: 0;
  background-image: linear-gradient(#ff6090, #E23636);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;

p {
  line-height: 1.5;

.big-thing {
  width: min(50ch, 100% - 2rem);
  margin: 0 auto;

.obj {
  --bg: white;
  --brd: #ff6090;
  width: 3vmin;
  height: 1.5vmin;
  border-top-right-radius: 30% 20%;
  border-bottom-right-radius: 30% 20%;
  border-top-left-radius: 30% 15%;
  border-bottom-left-radius: 30% 15%;
  border: 1px solid var(--brd);
  border-width: 0.5vmin 2.5vmin 0.5vmin 0.8vmin;
  box-shadow: 0 0 0 0.08em #000;
  background-color: var(--bg);

.path-cont:before {
  content: "0%";
  position: absolute;
  left: 40%;

.path-cont:after {
  content: "100%";
  position: absolute;
  right: 0;
  bottom: 0;

a {
  color: #ff6090;
  text-decoration-color: #ffafaf90;

Feel free to customize the colors, sizes, and shapes of the scroll indicator to match your website’s design aesthetics. You can adjust the path, animation speed, and other properties in the CSS code as needed.

That’s all! hopefully, you have successfully created a Squiggly Path Scroll Indicator on your website. If you have any questions or suggestions, feel free to comment below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...

Please Rel0ad/PressF5 this page if you can't click the download/preview link