title: Fade out sides of div tag with image background CSS
body: <p>I'm building a site, and I have an animating image in my header. This image is a coloured bar that animates from right to left on a loop to give the impression of it infinitely moving left.</p>
  
  <p>What I would like to accomplish, is to have a fade in/out effect on the left and the right side of the image, without affecting the animation of it's background image.</p>
  
  <p>This is my HTML code:</p>
  
  <pre><code>&lt;div id="hbaranim"&gt;&lt;div id="hbarchild"&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  
  <p>And my current CSS (with just the animating image):</p>
  
  <pre><code>#hbaranim {
  width: 100%;
  height: 5px;
  overflow-x: hidden;
  padding-bottom: 10px;
  padding-top: 10px;
  }
  #hbaranim #hbarchild {
  position: relative;
  width: 8524px;
  height: 5px;
  background-image: url("img/colorbartile.png");
  background-repeat: repeat-x;   
  -webkit-animation: hbaranim_roll linear 245s infinite;
  }
  @-webkit-keyframes hbaranim_roll {
  from { right: 0px; }
  to { right: 2131px; }
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/ghmskuqa/2/" rel="nofollow" title="Fiddle">JSFiddle</a></p>
  
  <p>Eddit: Currently using the HTML is using two div tags, but they don't have any content in them, so using just one would probably be better (not sure how to that to be honest...)</p>
  
  <p>Eddit 2: Just to clarify, the animating image is positioned over a gradient background, so just putting another gradient over the image like some of you suggested won't work in this case. It really need's to be transparent at the sides.</p>
  
  <p>Eddit 3: Some of you also suggested using a CSS gradient instead of an image, but the image I use on my actual site contains some other details that would be impossible to replicate in CSS. For this example I used an image that could indeed be replicated with a CSS gradient quite easily.</p>
  
  <p>Eddit 4: Updated the fiddle to include the whole header</p>