源代碼
點擊運行
<!DOCTYPE html> <html> <head> <title>Bootstrap 實例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/css/bootstrap.min.css"> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdn.staticfile.org/popper.js/1.12.5/umd/popper.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/4.1.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>提示框動畫</h2> <p>.fade 和 .show 類用於設置提示框在關閉時的淡出和淡入傚果:</p> <div class="alert alert-success alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>成功!</strong> 指定操作成功提示信息。 </div> <div class="alert alert-info alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>信息!</strong> 請注意這個信息。 </div> <div class="alert alert-warning alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>警告!</strong> 設置警告信息。 </div> <div class="alert alert-danger alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>錯誤!</strong> 失敗的操作。 </div> <div class="alert alert-primary alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>首選!</strong> 這是一個重要的操作信息。 </div> <div class="alert alert-secondary alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>次要的!</strong> 顯示一些不重要的信息。 </div> <div class="alert alert-dark alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>深灰色!</strong> 深灰色提示框。 </div> <div class="alert alert-light alert-dismissible fade show"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>淺灰色!</strong>淺灰色提示框。 </div> </div> </body> </html>
運行結果