Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda