How to make a label with behavior="scroll"?

Asked

Viewed 54 times

2

Follows code:

<marquee behavior="scroll" direction="left">Seu texto aqui</marquee>

How can I do this with label?

<label class="col-sm-2 col-form-label" for="Link">Seu texto aqui</label>

1 answer

2


You can emulate the behavior of <marquee> (which is now indicated as deprecated), in CSS with animation and translate().

.marquee {
  width: 100%;
  margin: 0 auto;
  white-space: nowrap;
  box-sizing: border-box;
  overflow: hidden;
}

.marquee-scroll {
  display: inline-block;
  padding-left: 100%;
  animation: scroll 10s linear infinite;
}

@keyframes scroll {
  0% {
    transform: translate(0, 0);
  }
  100% {
    transform: translate(-100%, 0);
  }
}
<div class="marquee">
  <label for="Link" class="marquee-scroll">Seu texto aqui</label>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.