.fade 和 .show 类用于设置提示框在关闭时的淡出和淡入效果:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap4 实例</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" rel="external nofollow" target="_blank" >
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
<script src="https://cdn.bootcss.com/popper.js/1.12.5/umd/popper.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
<script src="https://cdn.bootcss.com/bootstrap/4.1.0/js/bootstrap.min.js" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" ></script>
</head>
<body>
<div class="container">
<h2>提示框动画</h2>
<p>.fade 和 .show 类用于设置提示框在关闭时的淡出和淡入效果:</p>
<div class="alert alert-success alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>成功!</strong> 指定操作成功提示信息。
</div>
<div class="alert alert-info alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>信息!</strong> 请注意这个信息。
</div>
<div class="alert alert-warning alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>警告!</strong> 设置警告信息。
</div>
<div class="alert alert-danger alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>错误!</strong> 失败的操作。
</div>
<div class="alert alert-primary alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>首选!</strong> 这是一个重要的操作信息。
</div>
<div class="alert alert-secondary alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>次要的!</strong> 显示一些不重要的信息。
</div>
<div class="alert alert-dark alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>深灰色!</strong> 深灰色提示框。
</div>
<div class="alert alert-light alert-dismissable fade show">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>浅灰色!</strong>浅灰色提示框。
</div>
</div>
</body>
</html>
尝试一下 |