|
热门文章 |
|
|
|
|
纯CSS Lightbox效果 |
来源:5key.net 更新时间:2010/7/15 16:31:09 阅读次数: 我要投稿 |
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>纯CSS Lightbox效果 (无需JS)</title> <style> body{font-size:11px; font-family:Verdana, Arial, Helvetica, sans-serif;} a{color:#000; text-decoration:none;} .img{border:0px;} .black_overlay{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.8; opacity:.80; filter: alpha(opacity=80); } .white_content { display: none; position: absolute; top: 15%; left: 25%; width: 535px; height: 420px; border: 16px solid #FFF; border-bottom:none; background-color: white; z-index:1002; overflow: auto; } </style> </head> <body> <p><a href = "#" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'"><img src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081200073529.jpg" width="108" height="80"/></a></p> <div id="light" class="white_content"><img src="http://www.cwydesign.com/effects/UploadFiles_7074/201008/2010081200073529.jpg"/> <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a></div> <div id="fade" class="black_overlay"></div> </body> </html> |
特效说明: |
网络上有很多js版本的lightbox效果介绍。不过都下载一个lightbox的js小则几十K,大则上百K。如果你只是需要一个类似Lightbox的效果,这种百分之百纯CSS制造,不含js的办法到可以试试。原理很简单,看看就应该明白了。 |
|
上一篇文章: 漂亮的仿国外网站图片展示效果下一篇文章: 图片渐影轮播效果 |
|
|