Home >Web Front-end >JS Tutorial >✨ Interactive Neon Cursor Trail Effect ✨ Code

✨ Interactive Neon Cursor Trail Effect ✨ Code

DDD
DDDOriginal
2024-12-05 06:46:101052browse

✨ Interactive Neon Cursor Trail Effect ✨ Code

FOLLOW US ON THE INSTAGRAM: https://www.instagram.com/webstreet_code/

CODE

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Coder's Neon Cursor</title>
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
      background: #0d1117; /* Dark background for coding vibe */
      color: white;
      font-family: 'Courier New', monospace; /* Monospaced font for coder's feel */
      overflow: hidden;
      cursor: none; /* Hide default cursor */
      transition: background 0.5s ease;
    }

    /* Custom cursor style */
    .cursor {
      position: absolute;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background-color: #ffffff;
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); /* Neon glow effect */
      pointer-events: none;
      transform: translate(-50%, -50%);
      transition: all 0.1s ease;
    }

    /* Neon trail behind the cursor */
    .neon-trail {
      position: absolute;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      pointer-events: none;
      transform-origin: center;
      animation: trailEffect 1.5s ease-out forwards;
    }
    /* Trail expansion animation */
    @keyframes trailEffect {
      0% {
        transform: scale(1);
        opacity: 1;
      }
      100% {
        transform: scale(10);
        opacity: 0;
      }
    }
    /* Light border effect for the page */
    .page-border {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border: 2px solid #ffffff;
      pointer-events: none;
      box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
    }

  </style>
</head>
<body>

  <!-- Custom border around the page -->
  <div>




          

            
        

The above is the detailed content of ✨ Interactive Neon Cursor Trail Effect ✨ Code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn