10+ Best CSS Cursor Effects with HTML, CSS & JavaScript

CSS cursor effects can make a website feel more interactive by adding custom movement, trails, glows, hover reactions, and click animations. In this tutorial, you’ll learn how to create modern cursor effects using HTML, CSS, and JavaScript that you can customize and use in your own projects.

What We’re Building

In this collection of CSS cursor effects, we’ll build custom cursors, glowing followers, cursor trails, hover interactions, spotlight effects, click ripples, and gradient trails. Each effect is designed to be easy to understand, customize, and reuse.

Live Preview

Move your cursor inside this area

Add the HTML

Start with a simple HTML structure for the cursor effect. The preview area gives us a container where JavaScript can track the mouse position and move the custom cursor.

<div class="custom-cursor-area">

  <div class="custom-cursor"></div>

  <p>
    Move your cursor inside this area
  </p>

</div>

Style the Cursor with CSS

Next, use CSS to style the preview area and turn the cursor element into a glowing circular pointer. The custom cursor stays above the content while ignoring pointer events.

.custom-cursor-area{
  position:relative;
  min-height:280px;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
  background:#070d19;
  border:1px solid #1c2a40;
  border-radius:16px;
  cursor:none;
}

.custom-cursor-area p{
  color:#c7d2e5;
  font-size:16px;
  font-weight:600;
  pointer-events:none;
}

.custom-cursor{
  position:absolute;
  width:28px;
  height:28px;
  border:2px solid #22d3ee;
  border-radius:50%;
  background:rgba(34,211,238,.08);
  box-shadow:0 0 20px rgba(34,211,238,.25);
  transform:translate(-50%, -50%);
  pointer-events:none;
}

Add JavaScript Interaction

JavaScript tracks the mouse position inside the preview area and updates the custom cursor coordinates, allowing it to follow the pointer smoothly.

const area = document.querySelector('.custom-cursor-area');
const cursor = area.querySelector('.custom-cursor');

area.addEventListener('mousemove', function(event) {

  const rect = area.getBoundingClientRect();

  cursor.style.left =
    (event.clientX - rect.left) + 'px';

  cursor.style.top =
    (event.clientY - rect.top) + 'px';

});

How the Cursor Effect Works

The HTML creates the preview area and custom cursor element. CSS controls the cursor’s size, shape, glow, and appearance, while JavaScript tracks the mouse position and moves the custom cursor to the same coordinates. Together, these three parts create a smooth interactive cursor effect.

This same three-part structure β€” HTML for markup, CSS for appearance, and JavaScript for tracking β€” is used consistently across every cursor effect in this collection, which makes it easy to mix, adapt, or combine multiple effects once you understand the basic pattern.

Why Use Custom Cursor Effects?

Custom cursor effects can make interactive sections feel more engaging and help draw attention to buttons, links, images, and other important elements. When used carefully, they add personality to a design without changing the main layout or content.

A well-designed cursor effect can improve a website in several ways:

  • Guides attention β€” a glowing or expanding cursor naturally draws the eye toward buttons and clickable areas.
  • Adds a sense of polish β€” small interactive details like these are often what separate a template-feeling site from a custom-built one.
  • Reinforces brand personality β€” the color, shape, and motion style of a cursor effect can reflect a site’s overall tone, whether playful, minimal, or bold.
  • Improves perceived responsiveness β€” smooth cursor tracking makes a site feel faster and more interactive, even when it isn’t functionally different.

Where You Can Use Cursor Effects

Cursor effects work especially well on portfolios, creative websites, landing pages, product showcases, interactive galleries, and modern UI sections. You can use them to highlight clickable elements or simply make browsing feel more dynamic.

Some specific examples of where these effects work particularly well include:

  • Agency and freelancer portfolios, where a custom cursor reinforces a creative, design-forward brand.
  • Product landing pages, using a subtle glow or trail around key call-to-action buttons.
  • Photography or gallery websites, where an image-reveal or spotlight cursor adds a layer of visual storytelling.
  • SaaS marketing pages, where a magnetic or ring-style cursor on buttons adds a modern, premium feel without affecting page performance.

Customizing the Cursor Effect

You can easily customize the cursor by changing its size, border color, glow, opacity, and animation speed. You can also combine the basic cursor with trails, hover states, gradients, or ripple animations to create a style that matches your website.

Try It Yourself

Want to experiment with the code? Open the CodeRipple Playground, paste the HTML, CSS, and JavaScript, then customize the cursor size, colors, glow, and movement to create your own version.

Final Thoughts

CSS cursor effects are a simple way to add interactive details to modern websites. Once you understand how CSS styling and JavaScript mouse tracking work together, you can create everything from subtle cursor followers to more creative trails, glows, ripples, and hover effects.

Explore More CSS Cursor Effects

Custom Circle Cursor

A smooth custom circle cursor that follows mouse movement and creates a modern interactive feel for desktop websites.

Open in Playground β†’

Cursor Trail Effect

A smooth cursor trail effect that creates glowing dots behind the pointer for a modern interactive desktop experience.

Open in Playground β†’

Glow Cursor

A soft glowing cursor effect that follows mouse movement and adds a modern interactive highlight inside the preview area.

Open in Playground β†’

Magnetic Cursor

A magnetic hover interaction where the button gently moves toward the cursor for a smooth and modern interface effect.

Open in Playground β†’

Cursor Follower Dot

A small animated dot that smoothly follows the mouse pointer inside the preview area for a clean interactive cursor effect.

Open in Playground β†’

Blob Cursor

A soft animated blob that follows the mouse pointer and creates a fluid interactive cursor effect inside the preview area.

Open in Playground β†’

Text Hover Cursor

A custom cursor label that follows the mouse and changes its text when hovering over interactive items inside the preview area.

Open in Playground β†’

Image Reveal Cursor

An interactive cursor effect that reveals a different project image on hover and follows the mouse inside the preview area.

Open in Playground β†’

Cursor Spotlight Effect

A smooth spotlight that follows the mouse pointer and creates an interactive glow across a dark preview area.

Open in Playground β†’

Click Ripple Cursor

A click ripple effect that creates an expanding animated circle exactly where the user clicks inside the preview area.

Open in Playground β†’

Cursor Ring Hover Effect

A custom cursor ring that follows the pointer and expands when hovering over interactive elements inside the preview area.

Open in Playground β†’

Gradient Cursor Trail

A colorful cursor trail effect that creates soft gradient particles as the pointer moves across the preview area.

Open in Playground β†’
Scroll to Top