Text-Scroll Effect(problem)

<link href="https://fonts.googleapis.com/css?family=Montserrat:900&display=swap" rel="stylesheet">
<html>
  <body>
    <div id="text-elem">
    <div id="text-line-1">
      <span class="one">scroll</span>
      <span class="one">text</span>
      <span class="one">animation</span>
    </div>
    <div id="text-line-2">
      <span class="two">with</span>
      <span class="two">html</span>
      <span class="two">css</span>
    </div>
    <div id="text-line-3">
      <span class="three">and js</span>
      <span class="three">cheers 😃</span>
    </div>
    </div>
  </body>
</html>
body{
  margin:0;
  padding:0;
  background-color:#1A5276;
  font-family:'Montserrat';
  color:white;
  fill:red;
  overflow-x:hidden;
}
*{
  box-sizing:border-box;
}
#text-elem{
  display:grid;
  text-align:center;
  font-size:100px;
  text-transform:uppercase;
  margin-top:70px;
}
#text-line-1{
  display:flex;
  justify-content:space-evenly;
}

const span_1 = document.querySelectorAll('.one');
const span_2 = document.querySelector('#text-line-2');
const span_3 = document.querySelector('#text-line-3');
//events

document.addEventListener('mousemove',(e) => {
  let scroll = (e.pageX/2) * 0.2 - 1;
  let scroll_1 = -((e.clientX)/2);
  span_1.forEach((span) => {
   span.style.transform = `translatex(${scroll}px)`
  });
  span_2.forEach((span) => {
    span.style.transform = `translatex(${scroll_1}px)`
  });
   span_3.forEach((span) => {
    span.style.transform = `translatex(${scroll}px)`
  });
})

The span_2 and span_3 elements with eventlistener are not working .

span_2 and span_3 just single elements, not arrays. You can change their styles directly (without using forEach)

There’s a couple of issues:

#text-line-1{
  display:flex;
  justify-content:space-evenly;
}

Accounts just for one line of text.

const span_1 = document.querySelectorAll('.one');
const span_2 = document.querySelector('#text-line-2');
const span_3 = document.querySelector('#text-line-3');

Accounts for just one line of text.

I would avoid globals btw…