Here is one way to throw this cat:
HTML:
<div class="frame"> <div class="fade"></div> <img src="picture.jpg" alt=""/> </div>
CSS
.frame { width: 315px; height: 165px; margin: 20px; position: relative; } .fade { height: 100%; width: 100%; position:absolute; background: -webkit-linear-gradient(left, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.65) 100% ); }
Personally, I'm not a big fan of the (semantically) unnecessary div fade , and I'm sure there may be a smarter way to make the same effect without it, but it will work.
I have included the prefixed webkit rule, if you want to qualify, you will need to add prefixes from other providers.
Fiddle is here .
Update : If the image just serves as the background & mdash, as is the case in your related example - the gradient and image can be set in css for the containing element:
.frame { width: 315px; height: 165px; margin: 20px; background-image: url(picture.jpg); background-image: -webkit-linear-gradient(left, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 20%, rgba(0,0,0,0) 80%, rgba(0,0,0,0.9) 100% ), url(picture.jpg); } ... <div class="frame"> Content... </div>
Less muss, less fuss: a new-style violin with vendor prefixes and everything else.