html,body { height:100%; overflow:hidden; } body,div,h2 { margin:0; padding:0; } body { font:12px/1.5 Tahoma; } center { padding-top:10px; } button { cursor:pointer; } #win { position:absolute; top:50%; left:50%; width:400px; height:200px; background:#fff; border:4px solid #f90; margin:-102px 0 0 -202px; display:none; } h2 { font-size:12px; height:18px; text-align:right; background:#FC0; border-bottom:3px solid #f90; padding:5px; cursor:move; } h2 span { color:#f90; cursor:pointer; background:#fff; border:1px solid #f90; padding:0 2px; }
点击按钮弹出一个弹出层效果(屏幕正中间)且可拖拽效果,可自行设置弹出层的宽度和高度