html+css提示框/弹窗公告实例【记录】

在这里插入图片描述

https://blog.csdn.net/q906270629/article/details/125329110?ops_request_misc=&request_id=&biz_id=102&utm_term=HTML%E9%A1%B5%E9%9D%A2%E5%BC%B9%E5%87%BA%E5%85%AC%E5%91%8A&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-1-125329110.142v91insert_down1,239v9insert_chatgpt&spm=1018.2226.3001.4187


<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<title>首页</title>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, dataInfo-scalable=no" name="viewport">
	<script src="/js/frontH5/rem.js"></script>
	<script src="/js/frontH5/jquery.min.js" type="text/javascript"></script>
	<script src="/js/bootstrap/bootstrap.min.js"></script>
	<link rel="stylesheet" type="text/css" href="/css/frontH5/base.css"/>
	<link rel="stylesheet" type="text/css" href="/css/frontH5/page.css"/>
	<!--<link rel="stylesheet" type="text/css" href="/css/frontH5/all.css"/>-->

	<link rel="stylesheet" type="text/css" href="/css/frontH5/loaders.min.css"/>
	<link rel="stylesheet" type="text/css" href="/css/frontH5/loading.css"/>
	<link rel="stylesheet" type="text/css"  href="/js/bootstrap/bootstrap.min.css">
	<script src="/plugins/layer/layer.js"></script>

	<script type="text/javascript">
		$(window).load(function(){
			$(".loading").addClass("loader-chanage")
			$(".loading").fadeOut(300)
		})

		//设置 模态框不关闭
		$('#myModal').modal({
			backdrop: 'static', //点击遮罩层不会被关闭
			keyboard: false //按下esc键不会被关闭
		});

		$('#delModal').modal({
			backdrop: 'static', //点击遮罩层不会被关闭
			keyboard: false //按下esc键不会被关闭
		});

	</script>
	<!--<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>-->

	<style type="text/css">
		a:hover {text-decoration: none;}
	</style>

</head>
<!--loading页开始-->
<div class="loading">
	<div class="loader">
		<div class="loader-inner pacman">
			<div></div>
			<div></div>
			<div></div>
			<div></div>
			<div></div>
		</div>
	</div>
</div>
<!--loading页结束-->
<body>
<!-- 弹窗代码开始 -->
<div class="web_notice" style="position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0,0,0,0.3);z-index: 99999;">
	<div style="position: fixed;top: 50%;left: 50%;width: 550px;background: #FFF;transform: translate(-50%, -50%);border-radius: 40px;padding: 50px 40px;">
		<h3 style="font-weight: bold;text-align: center;font-size: 30px;">独山城区幼儿园/小学报名通知</h3>
		<div style="font-size: 16px;margin-top: 26px;line-height: 30px;color: #999;">
			<p style="text-align: left;text-indent: 4em;">独山城区幼儿园/小学报名通道暂未开通, </p>
			<bolder><p style="text-align: left;text-indent: 4em;color:red;font-size:12pt;">小学报名时间于81日至4日开始线上报名!!! </p></bolder>
			<p style="text-align: left;text-indent: 4em;">幼儿园另行通知! 敬请关注 </p>
		</div>
		<a style="display: block;background: #98a3ff;color: #FFF;text-align: center;font-weight: bold;font-size: 19px;line-height: 60px;margin: 0 auto;margin-top: 45px;border-radius: 32px;width: 80%;" onclick="javascript:document.querySelector('.web_notice').remove()">我知道了
		</a>
	</div>
</div>
<!-- 弹窗代码结束 -->
</body>
<script type="text/javascript">


</script>
<!--<script src="/js/admin/frontcommon.js"></script>-->
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是10种网页公告通知弹窗HTML 源码示例: 1. 简洁的提示框 ```html <div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 </div> ``` 2. 带有图标的提示框 ```html <div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <i class="fa fa-exclamation-triangle"></i><strong>注意!</strong> 这是一个提示框。 </div> ``` 3. 带有背景颜色的提示框 ```html <div class="alert info"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 </div> ``` ```css .alert { padding: 20px; background-color: #f44336; color: white; margin-bottom: 15px; } .info { background-color: #2196F3; } ``` 4. 带有动画效果的提示框 ```html <div class="alert success"> <span class="closebtn">×</span> <strong>成功!</strong> 这是一个提示框。 </div> ``` ```css .alert { padding: 20px; background-color: #f44336; color: white; margin-bottom: 15px; opacity: 1; transition: opacity 0.6s; } .success { background-color: #4CAF50; } .closebtn { margin-left: 15px; color: white; font-weight: bold; float: right; font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s; } .closebtn:hover { color: black; } ``` 5. 带有自动关闭功能的提示框 ```html <div class="alert"> <strong>注意!</strong> 这是一个提示框。 </div> ``` ```css .alert { padding: 20px; background-color: #f44336; color: white; margin-bottom: 15px; opacity: 1; transition: opacity 0.6s; } .alert.info { background-color: #2196F3; } .closebtn { margin-left: 15px; color: white; font-weight: bold; float: right; font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s; } .closebtn:hover { color: black; } /* 自动关闭 */ .auto-close { animation: auto-close 5s linear; } @keyframes auto-close { 0% { opacity: 1; } 25% { opacity: 1; } 75% { opacity: 0; } 100% { opacity: 0; display: none; } } ``` 6. 带有倒计时的提示框 ```html <div class="alert"> <strong>注意!</strong> 这是一个提示框。 <span class="countdown">5</span> 秒后自动关闭。 </div> ``` ```css .alert { padding: 20px; background-color: #f44336; color: white; margin-bottom: 15px; opacity: 1; transition: opacity 0.6s; } .alert.info { background-color: #2196F3; } .closebtn { margin-left: 15px; color: white; font-weight: bold; float: right; font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s; } .closebtn:hover { color: black; } /* 倒计时 */ .countdown { font-weight: bold; margin-left: 6px; } @keyframes countdown { from { opacity: 1; } to { opacity: 0; } } ``` ```javascript // JS 实现倒计时自动关闭 var timeleft = 5; var countdown = setInterval(function(){ timeleft--; document.querySelector(".countdown").textContent = timeleft; if (timeleft <= 0) { clearInterval(countdown); document.querySelector(".alert").classList.add("auto-close"); } }, 1000); ``` 7. 带有链接的提示框 ```html <div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 <a href="#">更多信息</a> </div> ``` 8. 带有输入提示框 ```html <div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 <input type="text" placeholder="请输入内容"> </div> ``` 9. 带有多个按钮的提示框 ```html <div class="alert"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 <button class="btn">确定</button> <button class="btn">取消</button> </div> ``` ```css .btn { background-color: white; color: black; border: none; padding: 5px 10px; text-align: center; text-decoration: none; display: inline-block; font-size: 16px; cursor: pointer; margin-left: 10px; } .btn:hover { background-color: #ddd; } ``` 10. 带有自定义样式的提示框 ```html <div class="alert my-style"> <span class="closebtn" onclick="this.parentElement.style.display='none';">×</span> <strong>注意!</strong> 这是一个提示框。 </div> ``` ```css .alert.my-style { padding: 30px; background-color: #4CAF50; color: white; margin-bottom: 20px; font-size: 20px; text-align: center; text-transform: uppercase; border-radius: 5px; } .closebtn { margin-left: 15px; color: white; font-weight: bold; float: right; font-size: 22px; line-height: 20px; cursor: pointer; transition: 0.3s; } .closebtn:hover { color: black; } ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值