类似这样的东西:
<div style="position:relative;margin:0 auto;display:block;width:150px;height:150px;overflow:hidden;">
<div style="position:absolute;top:0px;left:0px;border-radius:50px;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:0px;left:0px;" id="grainybackground"><img src="mygrainybackground.png"></div>
<div style="position:absolute;top:0px;left:0px;"><img src="my_transparant_great_looking borderimage.png" width="150" height="150">
</div>
然后是javascript:
document.getElementById("grainybackground").style.top = "-1px";
jsfiddle 上的完整演示代码: http: //jsfiddle.net/tLJgC/:
<div style="position:relative;margin:0 auto;display:block;width:156px;height:156px;overflow:hidden;">
<div style="position:absolute;top:3px;left:3px;border-radius:50%;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:0px;left:0px;background-color:grey;width:150px;height:150px;" id="grainybackground"><img src="mygrainybackground.png"></div>
<div style="position:absolute;top:0px;left:0px;border:3px solid black;border-radius:50%;width:147px;height:147px;"><!-- ingnore the border, didn't bother looking for aninside transparent bottlecap background image --><img src="my_transparant_great_looking borderimage.png" width="150" height="150">
</div>
和 javascript
for(c=0;c<150;c++)
{
window.setTimeout("document.getElementById('grainybackground').style.top=-(0+"+c+")+'px';console.log(0-c)",(100*c));
}
第二个带有更新信息的jsfiddle
http://jsfiddle.net/tLJgC/2/
<body background="http://hostmypicture.com/images/fundokairo.png">
<div style="position:relative;margin:0 auto;display:block;width:156px;height:156px;overflow:hidden">
<div style="position:absolute;top:3px;left:3px;border-radius:50%;background-color:red;width:150px;height:150px;">
<div style="position:absolute;top:3px;left:3px;width:150px;height:150px;background-image:url('http://hostmypicture.com/images/fundokairo.png');" id="grainybackground"></div>
<div style="position:absolute;top:0px;left:0px;width:150px;height:150px;"><img src="http://s23.postimg.org/mtc0673xj/mascara_Kairos.png" width="150" height="150">
</div>
和 javascript
for(c=0;c<150;c++)
{
window.setTimeout("document.getElementById('grainybackground').style.top=-(0+"+c+")+'px';document.getElementById('grainybackground').style.backgroundPosition = '"+c+"px "+c+"px'",(100*c));
}