主要修改弹窗窗口的样式

<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>html+css+js 弹窗窗口</title>
</head>
<style>
	* {
		/*所有的标签都有的属性遵循的统一样式*/
		padding: 0;
		margin: 0;
		/* 文字禁止选中 */
		user-select: none;
		/* 盒子模型 */
		box-sizing: border-box;
	}

	.chakai {
		background-image: linear-gradient(to top left,
				rgba(7, 9, 7, 0.699),
				rgba(58, 158, 91, 0.2) 20%,
				rgb(0, 0, 0));
		box-shadow:
			inset 2px 2px 3px rgba(74, 151, 91, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	h2 {
		width: 222px;
		height: 50px;
		/* 设置边框圆角 */
		border-radius: 10px;
		/* 设置字体大小 */
		font-size: 30px;
		/* 设置字体颜色 */
		color: #efed6a;
		/* 设置字体粗细 */
		font-weight: bold;
		/* 设置字体样式 */
		font-style: italic;
		/* 设置字体 */
		font-family: "微软雅黑", "宋体", "黑体";
		/* 设置文字位置 */
		margin: 20px 100px;
		background-color: rgba(220, 0, 0, 1);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 0, 0, 0.2) 30%,
				rgba(0, 0, 0, 0));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	.jiemian-box {
		/* 设置输入框大小 */
		width: 1200px;
		height: 100%;
		top: 100px;
		/* calc方法可以自动计算数值 */
		left: calc(50% - 270px);
		/* 设置背景颜色 */
		background: rgba(51, 150, 102, 0.5);
		margin: 20px;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(57, 40, 40, 0.2) 20%,
				rgba(0, 0, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	input {
		/* 设置输入框大小 */
		width: 320px;
		height: 50px;
		/* 设置输入框文字大小 */
		font-size: 30px;
		/* 设置输入框颜色 */
		color: #ffff;
		/* 设置边框圆角 */
		border-radius: 5px;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置内边距 */
		padding-left: 10px;
		margin: 20px;
		background-color: rgba(79, 132, 78, 0.774);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 1111, 0, 0.2) 53%,
				rgba(0, 1101, 0, 0.5));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		color: #fcf9f9;
		text-shadow: 1px 1px 1px #100000;
	}

	h2::before {
		/*查看的圆圈*/
		content: "";
		position: absolute;
		top: 104px;
		left: 360px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		border: 10px solid rgba(3, 227, 96, 0.916);
		box-shadow:
			inset 2px 2px 3px rgba(77, 137, 42, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	/* 设置添加按钮 */
	.chakai,
	.anni {
		/*相对定位*/
		position: relative;
		/* 鼠标移入变小手 */
		cursor: pointer;
		/*文字大小*/
		font-size: 20px;
		/*文字 加粗*/
		font-weight: bold;
		/*文字描边*/
		border: 1px solid #6f1468;
		width: 50px;
		height: 50px;
		/*设置间距*/
		margin: 10px;
		border-radius: 50%;
	}

	.chakai:hover,
	.anni:hover {
		color: #f1eaea;
		background-color: rgba(199, 76, 193, 0.929);
	}

	.chakai:active,
	.anni:active {
		box-shadow:
			inset -2px -2px 3px rgba(146, 168, 135, 0.11),
			inset 2px 2px 3px rgba(23, 15, 18, 0.22);
	}

	.anni::before {
		content: "";
		position: absolute;
		top: -11px;
		left: -11px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		border: 10px solid #f42e6a;
		box-shadow:
			inset 2px 2px 3px rgba(214, 176, 176, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	/*设置弹窗盒子*/
	.yingchang-box {
		/* 隐藏弹窗盒子
		display: none;*/
		/* 设置盒子大小 */
		width: 100%;
		height: 100%;
		top: 0;
		left: 0;
		top: 60px;
		/* calc方法可以自动计算数值 */
		left: calc(50% - 270px);
	}

	.yingchang-box,
	.box {
		top: 60px;
		/* calc方法可以自动计算数值 */
		left: calc(50% - 270px);
		/* 设置盒子大小 */
		width: 400PX;
		height: 560PX;
		/* 设置盒子圆角 */
		border-radius: 15px;
		/* 设置盒子相对定位 子级元素使用绝对定位时,父级元素就要用相对定位 */
		position: relative;
	}

	.box {
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置盒子阴影 */
		box-shadow: 8px 8px 8px #3f1e1e;
		/* 设置盒子 背景颜色 */
		background-color: #80e1e8;
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(57, 40, 40, 0.2) 30%,
				rgba(0.5, 255, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	.tianjiacaozuox {
		/* 设置盒子高度 */
		height: 70px;
		/* 设置背景颜色 */
		background: rgba(51, 150, 102, 0.5);
		/* 设置边框圆角 */
		border-radius: 15px 15px 0 0;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置盒子文字大小 */
		font-size: 30px;
		/* 鼠标移入呈现移动光标 */
		cursor: move;
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(57, 40, 40, 0.2) 40%,
				rgba(0, 225, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	.shurukuang {
		height: 380px;
		/* 设置盒子圆角 */
		border-radius: 10px;
		/* 设置背景颜色 */
		background: rgba(51, 150, 102, 0.5);
		margin: 20px;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(57, 40, 40, 0.2) 20%,
				rgba(0, 1000, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	.shurukuang input {
		/* 设置输入框大小 */
		width: 320px;
		height: 50px;
		/* 设置输入框文字大小 */
		font-size: 30px;
		/* 设置输入框颜色 */
		color: #ffff;
		/* 设置边框圆角 */
		border-radius: 5px;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置内边距 */
		padding-left: 10px;
		margin: 20px;
		background-color: rgba(79, 132, 78, 0.774);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 0, 0, 0.2) 53%,
				rgba(0, 1000, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		color: #fcf9f9;
		text-shadow: 1px 1px 1px #100000;
	}

	input::placeholder {
		color: rgba(236, 241, 239, 0.861);
	}

	.anniu {
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置按钮盒子大小 */
		height: 70px;
		/* 设置边框圆角 */
		border-radius: 0px 0px 15px 15px;
		/* 设置背景颜色 */
		background: rgba(51, 150, 102, 0.5);
		/* 设置盒子阴影 */
		box-shadow: 8px 8px 8px rgba(109, 40, 166, 0);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(57, 40, 40, 0.2) 60%,
				rgba(0, 250, 0, 1));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
	}

	i {
		/* 设置字体大小 */
		font-size: 40px;
		/* 设置字体颜色 */
		color: #bdb3b3;
		/* i标签默认是斜体 这个属性可以变正 */
		font-style: normal;
		/* 设置鼠标变小手 */
		cursor: pointer;
		/* 设置绝对定位 */
		position: absolute;
		margin-left: 340px;
		border-radius: 50%;
		margin-top: 10px;
		padding-left: 11px;
		padding-right: 11px;
		background-color: rgba(220, 0, 0, 1);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 0, 0, 0.2) 30%,
				rgba(0, 0, 0, 0));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		color: #fcf9f9;
		text-shadow: 1px 1px 1px #100000;
	}

	span {
		/* 设置添加操作标题位置 */
		position: absolute;
		border-radius: 15px;
		margin-top: 10px;
		margin-left: 10px;
		font-size: 1.2em;
		background-color: rgba(51, 150, 102, 0.5);
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 0, 0, 0.2) 30%,
				rgba(0, 1000, 200, 200));
	}

	.anniu input {
		/* 设置按钮大小 */
		width: 50px;
		height: 50px;
		/* 设置边框圆角 */
		border-radius: 50%;
		/* 设置边框 */
		border: 1px solid #3f1e1e;
		/* 设置相对定位*/
		position: relative;
		/* 设置鼠标变小手 */
		cursor: pointer;
		/* 设置间距 */
		margin-left: 30px;
		margin-top: 10px;
		left: 100px;
		/* 设置字体大小 */
		font-size: 20px;
		background-color: rgba(220, 0, 0, 1);
		background-image: linear-gradient(to top left,
				rgba(0, 0, 0, 0.2),
				rgba(0, 0, 0, 0.2) 30%,
				rgba(0, 0, 0, 0));
		box-shadow:
			inset 2px 2px 3px rgba(255, 255, 255, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		color: #fcf9f9;
		text-shadow: 1px 1px 1px #100000;
	}

	i:hover,
	.anniu input:hover {
		background-color: rgba(243, 212, 12, 0.155);
	}

	i::before {
		content: "";
		position: absolute;
		top: -11px;
		left: -11px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		border: 10px solid rgba(3, 227, 96, 0.916);
		box-shadow:
			inset 2px 2px 3px rgba(77, 137, 42, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	.anniu::before {
		content: "";
		position: absolute;
		left: 225px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		border: 10px solid rgba(3, 227, 96, 0.916);
		box-shadow:
			inset 2px 2px 3px rgba(77, 137, 42, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	span::before {
		/*添加的圆圈*/
		content: "";
		position: absolute;
		top: 480px;
		left: 110px;
		width: 50px;
		height: 50px;
		border-radius: 50%;
		border: 10px solid rgba(3, 227, 96, 0.916);
		box-shadow:
			inset 2px 2px 3px rgba(77, 137, 42, 0.6),
			inset -2px -2px 3px rgba(0, 0, 0, 0.6);
		text-shadow: 1px 1px 1px #100000;
	}

	.shurukuang input:active,
	i:active,
	.anniu input:active {
		box-shadow:
			inset -2px -2px 3px rgba(18, 5, 60, 0.904),
			inset 2px 2px 3px rgba(0, 0, 0, 0.6);
	}
</style>

<body background="yyds.jpg" style="background-repeat:no-repeat;background-attachment:fixed;
background-size:100% 100%;">
	<div>
		<h2> 账号密码保管箱</h2>
		<hr>
		<input type="text" name="user" id="user" /><button type="button" id="chakai" class="chakai"
			onclick="searchMess(this)">查看</button><button type="button" class="anni" value="">添加</button>
		</tbody>
		</table>
		<!-- 设置弹窗盒子 -->
		<div class="yingchang-box">
			<div class="box">
				<!-- 设置头部 -->
				<div class="tianjiacaozuox">
					<span>添加操作</span><i class="guanbi">&times</i>
				</div>
				<form>
					<!-- 设置输入框-->
					<div class="shurukuang">
						<input type="text" class="wangzhan" placeholder="请输入网站名称">
						<input type="text" class="zhuanghao" placeholder="请输入用户账号">
						<input type="password" class="mima" placeholder="请输入用户密码">
						<input type="text" class="beizhu" placeholder="请输入备注内容">
					</div>
					<div class="anniu">
						<!--提交按钮-->
						<input type="submit" value="添加" class="tj">
						<!--重置按钮-->
						<input type="reset" value="重置" class="cz">
				</form>
			</div>
		</div>
	</div>
	</div>
	</div>
	<script>
		// 添加移动框
		// 添加页面加载事件
		window.addEventListener("load", () => {
			// 获取打开按钮
			const open = document.querySelector(".anni");
			// 获取关闭按钮
			const close = document.querySelector(".guanbi");
			// 获取整个大的模态框
			const fillScreen = document.querySelector(".yingchang-box");
			// 获取模态框可移动的头部区域
			const header = document.querySelector(".tianjiacaozuox");
			// 获取模态框珠主区域
			const modelBox = document.querySelector(".box");
			// 做打开功能
			open.addEventListener("click", () => {
				// 点击打开按钮 改变display属性值
				fillScreen.style.display = "block";
			});
			// 关闭功能
			close.addEventListener("click", () => {
				fillScreen.style.display = "none";
			});
			header.addEventListener("mousedown", (event) => {
				const x = event.pageX - modelBox.offsetLeft;
				const y = event.pageY - modelBox.offsetTop;
				console.log(x, y);
				document.addEventListener("mousemove", move);
				function move(event) {
					modelBox.style.left = event.pageX - x + "px";
					modelBox.style.top = event.pageY - y + "px";
				}
				document.addEventListener("mouseup", () => {
					document.removeEventListener("mousemove", move);
				});
			});
		});
	</script>
</body>

</html>

  • 15
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值