Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <section id="main">
    <!--Navigation-->
    <nav>
      <div class="logo">
        <a href="#">LOGO</a>
      </div>
      <input class="menu-btn" type="checkbox" id="menu-btn" />
      <label class="menu-icon" for="menu-btn">
        <span class="nav-icon"></span>
      </label>
      <!--Navigation-->
      <ul class="menu">
        <li><a href="#main">Home</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </nav>

    <div class="main-text">
      <p>Hello!</p>
      <p>
        This page has a custom scrollbar<br>
        Keep scrolling down
      </p>
      <a href="#" class="btn-primary">Just a Button</a>
    </div>
    <img src="https://omjsblog.wordpress.com/wp-content/uploads/2024/05/untitled-design6.png" class="rocket" alt="Rocket" />
  </section>
  <!--About Me-->
  <div class="about reveal fade-bottom">
    <div class="about-text">
      <h2>What's a Scrollbar?</h2>
      <p>
        A long thin section at the edge of a computer display by which material can be scrolled using a mouse.
      </p>
      <p>
        By styling the scrollbar, you can create a more visually appealing site that better aligns with your brand or
        design.
      </p>
    </div>
  </div>
              
            
!

CSS

              
                @charset "utf=8";
@import url("https://fonts.googleapis.com/css2?family=Poppins&display=swap");

body {
  margin: 0px;
  padding: 0px;
  font-family: "Poppins", sans-serif;
  background-color: #301934;
}
* {
  box-sizing: border-box;
  scroll-behavior: smooth;
}
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: auto;
    scrollbar-color: #553c9a #301934;
  }
}
::-webkit-scrollbar {
  width: 13px;
}
::-webkit-scrollbar-thumb {
  background: rgba(85, 60, 154, 0.3);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
::-webkit-scrollbar-track {
  background-color: #301934;
}
::-webkit-scrollbar-button{
  background-color: #301934;
  background-repeat: no-repeat;   
  background-size: 100%;
  background-position: center;
 }
::-webkit-scrollbar-button:decrement {
  background-image: url("https://omjsblog.wordpress.com/wp-content/uploads/2024/05/rocket-up.png");   
 }
::-webkit-scrollbar-button:increment {
  background-image: url("https://omjsblog.wordpress.com/wp-content/uploads/2024/05/rocket-down.png"); 
}
ul {
  list-style: none;
}
a {
  text-decoration: none;
}
nav {
  display: inline-flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  position: fixed;
  width: 100%;
  background: rgba(85, 60, 154, 0.1);
  backdrop-filter: blur(15px);
  /* -webkit-backdrop-filter: blur(15px); */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0px 5%;
  z-index: 1;
}
.logo a {
  font-weight: 700;
  color: #b393d3;
  font-size: 2rem;
  letter-spacing: 0.5px;
}
nav ul {
  display: flex;
}
nav ul li a {
  height: 40px;
  line-height: 43px;
  margin: 10px;
  padding: 0px 30px;
  display: flex;
  font-size: 1rem;
  font-weight: 500;
  color: #b393d3;
  transition: 0.1s;
}
nav ul li a:hover {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: #fff;
  text-shadow: 0px 0px 10px #fff, 0px 0px 10px #553c9a, 0px 0px 20px #553c9a,
    0px 0px 40px #553c9a, 0px 0px 80px #fff;
}
#main {
  background-color: #301934;
  width: 100%;
  height: 100vh;
  position: relative;
}
.main-text p:nth-child(1) {
  font-weight: 500;
  font-size: 27px;
  line-height: 1px;
}
.main-text p:nth-child(2) {
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}
.main-text p:nth-child(3) {
  font-size: 20px;
  font-weight: 500;
  color: #fff;
}
.main-text {
  position: absolute;
  left: 20%;
  top: 50%;
  transform: translate(-13%, -42%);
  z-index: 1;
}
.main-text p {
  color: #b393d3;
  margin: 23px 0px 25px;
  line-height: 58px;
}
.main-text p a {
  color: #553c9a;
  padding: 0;
}
.main-text a,
.about a {
  width: 150px;
  height: 42px;
  outline: none;
  margin: 0px;
  padding: 0.8rem;
  border-radius: 7px;
  font-size: 17px;
  font-weight: 200;
}
.btn {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #b393d3;
}
.btn-primary {
  background: rgba(0, 194, 203, 0.05);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #553c9a;
}
.btn:hover,
.btn-primary:hover {
  color: #ffffff;
  text-shadow: 0px 0px 10px #fff, 0px 0px 10px #553c9a, 0px 0px 20px #553c9a,
    0px 0px 40px #553c9a, 0px 0px 80px #fff;
}
.rocket {
  height: 560px;
  position: absolute;
  bottom: 0px;
  left: 80%;
  transform: translateX(-70%);
  filter: grayscale(30%);
}
.about {
  width: 75%;
  height: 350px;
  background-color: #301934;
  border-radius: 20px;
  box-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  margin: -3% auto 20px auto;
  position: relative;
  justify-content: space-evenly;
  align-items: center;
}
.about-text {
  color: #e0ffff;
  width: 800px;
  text-align: center;
}
.about-text h2 {
  color: #b393d3;
  font-weight: 600;
  font-size: 30px;
  line-height: 0px;
  padding-bottom: 1rem;
}
.about-text p {
  font-size: 17px;
  padding-bottom: 0.5rem;
}
nav .menu-btn {
  display: none;
}
.reveal {
  opacity: 0;
}

.reveal.active {
  opacity: 1;
}
.active.fade-bottom {
  animation: fade-bottom 1s ease-in-out;
}

@keyframes fade-bottom {
  0% {
    transform: translateY(50px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 1000px) {
  * {
    box-sizing: border-box;
  }
  .rocket {
    height: 460px;
    left: 90%;
    transform: translateX(-90%);
  }
  .main-text {
    top: 46%;
  }
  .about {
    width: 90%;
    border-radius: 10px;
  }
  .about-text {
    width: 400px;
  }
}
@media (max-width: 1140px) {
  .content {
    width: 100%;
  }
  .rocket {
    height: 438px;
  }
  .main-text,
  .rocket {
    margin: 10px;
  }
  .main-text h1 {
    font-size: 3rem;
  }
}
@media (max-width: 900px) {
  nav {
    justify-content: space-between;
    height: 65px;
    padding: 0px 30px;
  }
  .logo {
    height: 35px;
  }
  .menu {
    display: none;
    position: absolute;
    top: 65px;
    left: 0px;
    background-color: #301934;
    border-bottom: 1px solid rgba(85, 60, 154, 0.1);
    width: 100%;
    padding: 0px;
    margin: 0px;
  }
  .menu li {
    width: 100%;
  }
  nav .menu li a {
    width: 100%;
    height: 40px;
    justify-content: center;
    align-items: center;
    margin: 0px;
    padding: 25px;
    border: 1px solid rgba(38, 38, 38, 0.03);
  }
  nav .menu-icon {
    cursor: pointer;
    float: right;
    padding: 28px 20px;
    position: relative;
    user-select: none;
  }
  nav .menu-icon .nav-icon {
    background-color: #b393d3;
    display: block;
    height: 2px;
    position: relative;
    transition: background 0.2s ease-out;
    width: 18px;
  }
  nav .menu-icon .nav-icon::before,
  nav .menu-icon .nav-icon::after {
    background: #b393d3;
    content: "";
    display: block;
    height: 100%;
    position: absolute;
    transition: all ease-out 0.2s;
    width: 100%;
  }
  nav .menu-icon .nav-icon:before {
    top: 5px;
  }
  nav .menu-icon,
  .nav-icon:after {
    top: -5px;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon {
    background: transparent;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon:before {
    transform: rotate(-45deg);
    top: 0;
  }
  nav .menu-btn:checked ~ .menu-icon .nav-icon:after {
    transform: rotate(45deg);
    top: 0;
  }
  nav .menu-btn {
    display: none;
  }
  nav .menu-btn:checked ~ .menu {
    display: block;
  }
  .rocket {
    display: none;
  }
}
@media (max-width: 750px) {
  .rocket {
    display: none;
  }
  .about {
    top: 0px;
    margin-top: 0;
    flex-direction: column;
    width: 90%;
    height: auto;
    padding: 30px 0px;
    align-items: center;
  }
  .about-text {
    width: 90%;
  }
}
@media (max-width: 720px) {
  .rocket {
    display: none;
  }
  .main-text {
    width: 70%;
    position: absolute;
    left: 50%;
    top: 60%;
    transform: translate(-50%, -50%);
  }
}

              
            
!

JS

              
                    function reveal() {
      var reveals = document.querySelectorAll(".reveal");

      for (var i = 0; i < reveals.length; i++) {
        var windowHeight = window.innerHeight;
        var elementTop = reveals[i].getBoundingClientRect().top;
        var elementVisible = 150;

        if (elementTop < windowHeight - elementVisible) {
          reveals[i].classList.add("active");
        } else {
          reveals[i].classList.remove("active");
        }
      }
    }

    window.addEventListener("scroll", reveal);
              
            
!
999px

Console