You can create an absolute positioned div with the background image property and then use animate.css to add an animation without having to create the keyframes yourself
http://jsfiddle.net/n9wd4ver/5/
.initials {
width: 100%;
height: 100%;
}
.initials.initials-text {
padding:20px 0px;
position: relative;
z-index: 2;
}
.initials.initials-background {
position: absolute;
background-image: url("http://static.tumblr.com/lxn1yld/Hnxnxaqya/space.gif");
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-o-animation-delay: 3s;
animation-delay: 3s;
z-index: 1;
}
.initials-container {
height: 100%;
margin-top:20px;
margin-left:20px;
position:relative;
background:black;
color:white;
width:60px;
text-align:center;
font-size:17px;
letter-spacing:5px;
box-shadow:0px 2px 3px rgba(0,0,0,.15);
overflow: hidden;
white-space: nowrap;
}
HTML:
<div class="initials-container">
<div class="initials initials-background animated fadeIn"></div>
<div class="initials initials-text">A</div>
</div>
EDIT: OP asked in a comment how to check if the image has been loaded. I'm assuming you don't want to use jQuery, so you can use a library called imagesLoaded (which works both with and without jQuery) and check for image being loaded this way:
http://jsfiddle.net/n9wd4ver/7/
CSS
.initials {
width: 100%;
height: 100%;
}
.initials.initials-text {
padding:20px 0px;
position: relative;
z-index: 2;
}
#initials-background {
position: absolute;
background-image: url("http://static.tumblr.com/lxn1yld/Hnxnxaqya/space.gif");
-webkit-animation-delay: 3s;
-moz-animation-delay: 3s;
-o-animation-delay: 3s;
animation-delay: 3s;
z-index: 1;
opacity: 0;
}
#initials-background.animated {
opacity: 1;
}
.initials-container {
margin-top:20px;
margin-left:20px;
height: 100%;
position:relative;
background:black;
color:white;
width:60px;
text-align:center;
font-size:17px;
letter-spacing:5px;
box-shadow:0px 2px 3px rgba(0,0,0,.15);
overflow: hidden;
white-space: nowrap;
}
HTML
<div class="initials-container">
<div id="initials-background" class="initials fadeIn">
</div>
<div class="initials initials-text">
A
</div>
</div>
Javascript
imagesLoaded( '#initials-background', { background: true }, function() {
console.log("image loaded");
var d=document.getElementById("initials-background");
d.className=d.className +" animated";
});