- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>DIV层居中遮罩</title>
- <style>
- #overlay {
- position:absolute;
- top:0;
- left:0;
- width:100%;
- height:100%;
- background:#000;
- opacity:0.5;
- filter:alpha(opacity=50);
- }
- #win {
- position:absolute;
- top:50%;
- left:50%;
- width:400px;
- height:200px;
- background:#fff;
- margin:-102px 0 0 -202px;
- line-height: 200px;
- text-align: center;
- border: 4px solid #CCC;
- }
- </style>
- <script>
- </script>
- </head>
- <body>
- <div id="overlay"></div>
- <div id="win">层居中:)更多:<a href='<a href="http://www.iiwnet.com">http://www.iiwnet.com'>网页特效</a></div>
- </body>
- </html>
- //该片段来自于http://www.codesnippet.cn/detail/280420133069.html
来源: http://www.codesnippet.cn/detail/280420133069.html