Hosting Solutions
mobile_logo Table of Contents
seal_frontseal_back

Background Position keyframes Animation CSS Tutorial

Learn to animate background images in multiple directions. Your backgrounds can animate in any direction, up, down, left, right, or even diagonally. We will be using the CSS keyframes rule and the background-position property to create the effect.

example.html <!DOCTYPE html> <html> <head> <style> body{ margin: 0px; background: #000; } div#banner{ width: 100%; height: 300px; margin: 0px auto; /* overflow: hidden; */ background: url(brick_tile.jpg) repeat; animation: animate-background linear 15s infinite; } @keyframes animate-background { from { background-position: 0px 0px; } to { background-position: 300px 0px; } } div#banner > h1{ color: #FFF; padding: 50px; } </style> </head> <body> <div id="banner"> <h1>My content goes here</h1> </div> </body> </html>
thumb

CSS Videos

Animation Rigging

Holiday Christmas Lights Animation Tutorial CSS JavaScriptParallax Effect Animation Multiple Background CSS TutorialBackground Position keyframes Animation CSS TutorialFolding Content Nav Menu CSS3 Animation JavaScript TutorialPure CSS Animated Menu Button Transitionskeyframes Animation Tutorial Floating ElementsAnimated Repeating Tile Background keyframes TutorialFlip 3D Boxes and Cards Animation CSS TutorialFlash and Pulse Effects keyframes Animation TutorialImage Zoom Effect Animation CSS3 HTML Tutorial