1.要求和思路
点击弹出+拖拽+点击关闭
2.完整代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
a {
text-decoration: none;
color: #000000;
}
/* 1.点击前的文字和样式 */
.login-header {
width: 100%;
height: 30px;
line-height: 30px;
text-align: center;
font-size: 30px;
}
/* 2.点击弹出的登录框 */
/* 登录框外部样式 */
.login {
width: 512px;
height: 280px;
border: 1px solid #ebebeb;
box-shadow: 0px 0px 20px #ddd;
background: #ffffff;
position: absolute;
left: 500px;
top: 140px;
/* 放在遮罩层之上 */
z-index: 9999;
display: none;
}
/* 登录框标题和关闭按钮 */
.login-title {
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
margin-top: 10px;
position: relative;
cursor: move;
/* 火狐 */
-moz-user-select: none;
/* webkit */
-webkit-user-select: none;