I've hit a roadblock trying to prevent a background image from extending beyond its DIV. I've had to resort to some less than ideal methods.
.animation span {
position: absolute;
top: 0;
width: 100%;
height: 100%;
z-index: -999;
animation-name: fade;
animation-iteration-count: infinite;
animation-duration: 40s;
background-size: cover cover;
background-repeat: no-repeat;
background-position: center center;
}
...
<body>
<div id='banner'>
<div class="animation">
<span id="f4"></span>
<span id="f3"></span>
<span id="f2"></span>
<span id="f1"></span>
</div>
<div id="title">
<h1>Silly Webpage Banner</h1>
</div>
</div>
<div id="content" style="background-color:white;">
Content
</div>
</body>
I ended up applying width, height, and top properties to the animation class just to display the image properly. Without a z-index, the content DIV ends up behind. Ideally, I would like it to adhere to background-size and background-position, but I can't seem to make it work.