Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
how do i create a contrail for a mouse with html

I'm trying to make a website in where a word "lean" follows your cursor. there are two issues i have that I'm struggling with. first: the <div id="circle">lean</div>(see html below) element only works when there is text above it. my second problem is that the word is stuck in the right corner and wont move.

here is my code:

let circle = document.getElementById('circle');

const onMouseMove = (e) => {
  circle.style.left = e.pageX + 'px';
  circle.style.top = e.pageY + 'px';
}

document.addEventListener('mousemove', onMouseMove);
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: white;
  color: #8A2BE2;
}

div {
  position: absolute;
  transform: translate(-50%, -50%);
  height: 35px;
  width: 35px;
}
a
<div id="circle">
  lean
</div>

is it possible that this has something to do with the version of the html files? i have largely created this html from a combination of other old tutorials. sorry if this is a dumb question, I'm still a novice programmer.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!