CSS代码二例:边框阴影效果与DIV层垂直居中,在本代码中,实现的是CSS边框阴影(很多时候被勇于顶部banner框),及让框架内内容垂直居中。阴影效果做的不错,供新手参考学习,也欢迎提出整改方案。 示例: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>边框为阴影效果</title> <style type="text/css"> div {border-width: 1px; border-style: solid; padding: 1px;} .a {background-color: #F3F3F3; border-color: #FBFBFB;} .b {background-color: #D8D8D8; border-color: #E8E8E8;} .c {background-color: #FFF; border-color: #BBB; height: 100px;color:#ff0000;} .middle-veryhuo-4{ width:300px; border:#FF0000 1px solid; height: 300px; position:absolute; } .middle-veryhuo-4 div{ border:#009900 1px solid; height:20px; width:300px; position:absolute; margin-top:-10px; top:50%; left:0; } .middle-veryhuo-4 div div{ border:#330066 1px solid; height:20px; width:300px; margin-top:-12px; margin-left:-2px; position:relative; top: 50%; left:0; } </style> </head> <body> <div class="a"> <div class="b"> <div class="c"> 边框为阴影效果 </div> </div> </div> <div class="middle-veryhuo-4"> <div> <div> 让内容垂直居中 </div> </div> </div> </body> </html><div style="text-align:center;margin:30px 0 0 0;"><hr style="color:#999;height:1px;">如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></div>提示:可修改后代码再运行! 文章导航 子鼠CSS相册效果,图片点击切换展示代码CSS网页背景渐变代码,仅兼容chrome/Safari浏览器