Animated Repeating Tile Background keyframes Tutorial
Learn to create animated repeating tile backgrounds using HTML and CSS. (1) Make the width of your banner_backdrop the width of your banner plus the width of your repeating tile image. (2) Be sure to set the banner to overflow:hidden;. (3) Animate the banner_backdrop either right or left, only the distance enough to reach the next tile. It then loops over and over seamlessly to produce a smooth fluid effect. Try it with clouds and space repeating tile backgrounds for some real fun. Create beautiful animated repeating tile backgrounds for any content boxes, banners, headers, or any area of your web page. We will be using CSS keyframes to accomplish this task.
<!DOCTYPE html>
<html>
<head>
<style>
body{ margin:48px; background:#000; font-family: Arial, Helvetica, sans-serif; }
div#banner{
width: 1000px;
height: 200px;
margin: 0px auto;
border: #639 1px solid;
overflow: hidden;
}
div#banner > #banner_backdrop{
position: relative;
background: url(repeater.jpg) repeat-x;
width: 1320px;
height: 200px;
animation: backdrop_roll linear 12s infinite;
}
@keyframes backdrop_roll { from { right: 0px; } to { right: 320px; } }
div#banner > #banner_content{
position: relative;
width: 96%;
height: 160px;
margin: 20px auto;
top:-200px;
color:#FFF;
font-size:27px;
}
</style>
</head>
<body>
<div id="banner">
<div id="banner_backdrop"></div>
<div id="banner_content">
Put anything you want inside this box...
</div>
</div>
</body>
</html>