Tips and Tricks for Website Creation
 
Scrolling Text – Slide In

Scrolling Text – Slide In

This post contains CSS and HTML code for creating scrolling text that slides in from the right.

Preview

Slide-in text.

Code

<!-- Styles -->	
<style>
.example4 {
 height: 50px;	
 overflow: hidden;
 position: relative;
}
.example4 h3 {
 position: absolute;
 width: 100%;
 height: 100%;
 margin: 0;
 line-height: 50px;
 text-align: left;

 /* Apply animation to this element */	
 -moz-animation: example4 10s ease-out;
 -webkit-animation: example4 10s ease-out;
 animation: example4 10s ease-out;
}
/* Move it (define the animation) */
@-moz-keyframes example4 {
 0%   { -moz-transform: translateX(200%); }
 100% { -moz-transform: translateX(0%); }
}
@-webkit-keyframes example4 {
 0%   { -webkit-transform: translateX(200%); }
 100% { -webkit-transform: translateX(0%); }
}
@keyframes example4 {
 0%   { 
 -moz-transform: translateX(200%); /* Firefox bug fix */
 -webkit-transform: translateX(200%); /* Firefox bug fix */
 transform: translateX(200%); 		
 }
 100% { 
 -moz-transform: translateX(0%); /* Firefox bug fix */
 -webkit-transform: translateX(0%); /* Firefox bug fix */
 transform: translateX(0%); 
 }
}
</style>

<!-- HTML -->
<div class="example4">
<h3>Slide-in text.</h3>
</div>