marquee (kayan yazı)

by Destan Sarpkaya

HTML

<div id=x class="parent">

  <div class="marquee">
    Many desktop publishing packages and web page editors now use Lorem ipsum dolor sit amet!
  </div>

</div>

CSS

.parent {
	width: 450px;
	line-height: 50px;
	background-color: red;
	color: white;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}
.marquee {
    display: inline-block;
    animation: marquee 5s linear infinite;
}
@keyframes marquee {
    0%   { transform: translate(0, 0); }
	30%   { transform: translate(0, 0); }
	70% { transform: translate(-222px, 0); }
	100% { transform: translate(-222px, 0); }
}

JavaScript

element=document.getElementById('x')
//alert(element.scrollWidth - element.clientWidth)