CSS relative属性技能之幻影瞬移实例页面
代码:
CSS代码:
.rel { position:relative; }
HTML代码:
<img src="//image.zhangxinxu.com/image/study/s/s128/mm1.jpg" /> <img class="rel" src="//image.zhangxinxu.com/image/study/s/s128/mm2.jpg" /> <img src="//image.zhangxinxu.com/image/study/s/s128/mm3.jpg" /> <p>上面第二张图片position属性为relative</p> <p><input type="button" id="button" value="点击我-展示幻影瞬移" /></p>
JS代码:
$("#button").click(function() { $("img").css("left", "-999em"); });
效果:
上面第二张图片position属性为relative