JS/CSS 各种操作信息提示效果
2024-10-01 17:05:31
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS/CSS 各种操作信息提示效果</title>
<style>
.alert {
padding: 20px;
background-color: #f44336;
color: white;
opacity: 1;
transition: opacity 0.6s;
margin-bottom: 15px;
} .alert.success {background-color: #4CAF50;}
.alert.info {background-color: #2196F3;}
.alert.warning {background-color: #ff9800;} .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;
}
</style>
</head> <body>
<h2>提示信息</h2>
<p>点击 "x" 关闭提示框。</p>
<div class="alert">
<span class="closebtn">×</span>
<strong>危险!</strong> 危险操作提示。
</div> <div class="alert success">
<span class="closebtn">×</span>
<strong>成功!</strong> 操作成功提示。
</div> <div class="alert info">
<span class="closebtn">×</span>
<strong>提示!</strong> 提示信息修改等。
</div> <div class="alert warning">
<span class="closebtn">×</span>
<strong>警告!</strong> 提示当前操作要注意。
</div>
<script>
var close = document.getElementsByClassName("closebtn");
var i; for (i = 0; i < close.length; i++) {
close[i].onclick = function(){
var div = this.parentElement;
div.style.opacity = "0";
setTimeout(function(){ div.style.display = "none"; }, 600);
}
} </script>
</body>
</html>
最新文章
- 【原】Learning Spark (Python版) 学习笔记(二)----键值对、数据读取与保存、共享特性
- 在用到select2时,临时抱佛脚学习了一下
- 还原ORACLE DUMP 的值
- Django开发博客- 三部曲
- 【算法入门】广度/宽度优先搜索(BFS)
- B&#39;day Gift
- current imporant Posts
- invalid nib registered for identifier (重用符) - nib must contain exactly one top level object which must be a UITableViewCell instance&#39;
- Android 检测是否连接蓝牙耳机
- C# 之 static的用法详解
- 谈谈Nginx-HTTPS加密技术
- 在Ubuntu1404的64bit版本下安装caffe
- [HTML]html读取本地文件并显示
- android--------Socket的简单了解
- Liberty Mutual Property Inspection, Winner&#39;s Interview: Qingchen Wang
- MongoDB副本集配置系列二:配置MongoDB副本集
- axios构建缓存池存储基础数据
- Gitlab CI-1.Gitlab部署
- 【大数据】Hadoop的高可用HA
- vim 折叠的用法
热门文章
- Centos7 网络出错(failed to start LSB: Bring up/down networking )
- avalon 笔记---Mr.wing
- BZOJ 1050 枚举+并查集
- 变量对象、作用域链和This
- 实现人脸识别性别之路---网页上的video标签
- js编码方式详解
- 无闻go编程基础笔记
- GCJ1C09C - Bribe the Prisoners
- Android基础新手教程——1.2.1 使用Eclipse + ADT + SDK开发Android APP
- [Python] Find available methods and help in REPL