Foundation 提醒框

收藏113

阅读22181

更新时间2022-04-14

Foundation 可以很简单的创建一个提醒框:

提醒框可以使用 .alert-box 类创建, 可以添加可选的类: .secondary, .success, .info, .warning.alert:

实例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>提醒框</h2>
  <div data-alert class="alert-box">
    This is a default alert box.
  </div>

  <div data-alert class="alert-box secondary">
    This is a secondary alert box.
  </div>

  <div data-alert class="alert-box success">
    <strong>Success!</strong> This alert box indicates a successful or positive action.
  </div>

  <div data-alert class="alert-box info">
      <strong>Info!</strong> This alert box indicates a neutral informative change or action.
  </div>

  <div data-alert class="alert-box warning">
      <strong>Warning!</strong> This alert box indicates a warning that might need attention.
  </div>

  <div data-alert class="alert-box alert">
      <strong>Alert!</strong> This alert box indicates a dangerous or potentially negative action.
  </div>
</div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Note提醒框的宽度为容器的 100%。

圆角提醒框

.radius.round 类用于为提醒框添加圆角:

实例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>圆角提醒框</h2>
  <div data-alert class="alert-box">
    Default Alert box
  </div>

  <div data-alert class="alert-box radius">
    Default Alert box with a radius.
  </div>

  <div data-alert class="alert-box secondary radius">
    Secondy Alert box with a radius.
  </div>

  <div data-alert class="alert-box success radius">
    <strong>Success!</strong> Alert box with a radius.
  </div>

  <div data-alert class="alert-box info round">
      <strong>Info!</strong> Alert box that is rounded.
  </div>

  <div data-alert class="alert-box warning round">
      <strong>Warning!</strong> Alert box that is rounded.
  </div>

  <div data-alert class="alert-box alert round">
      <strong>Alert!</strong> Alert box that is rounded.
  </div>
</div>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


关闭提醒框

要关闭提醒框,可以在连接或按钮元素上添加 class="close" 类,并初始化 Foundation JS:

实例

<!DOCTYPE html>
<html>
<head>
  <title>Foundation 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css">
  <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script>
  <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script>
</head>
<body>

<div style="padding:20px;">
  <h2>关闭提醒框</h2>
  <div data-alert class="alert-box">
    This is a default alert box.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box secondary">
    This is a secondary alert box.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box success">
    <strong>Success!</strong> This alert box indicates a successful or positive action.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box info">
    <strong>Info!</strong> This alert box indicates a neutral informative change or action.
    <a href="#" class="close">×</a>
 </div>

  <div data-alert class="alert-box warning">
    <strong>Warning!</strong> This alert box indicates a warning that might need attention.
    <a href="#" class="close">×</a>
  </div>

  <div data-alert class="alert-box alert">
    <strong>Alert!</strong> This alert box indicates a dangerous or potentially negative action.
    <a href="#" class="close">×</a>
  </div>
</div>

<script>
// 创始化 Foundation JS 
$(document).ready(function() {
    $(document).foundation();
})
</script>

</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

Note&times; (×) 是一个 HTML 字符实体表示一个关闭按钮的图标,而不是字母  "x"。

相关

视频

RELATED VIDEOS

更多

免费

Web前端开发极速入门
初级 Web前端开发极速入门

219920次学习

收藏

免费

前端入门_HTML5
初级 前端入门_HTML5

616946次学习

收藏

免费

30分钟学会网站布局
初级 30分钟学会网站布局

238440次学习

收藏

免费

CSS视频教程-玉女心经版
初级 CSS视频教程-玉女心经版

393054次学习

收藏

免费

独孤九贱(1)_HTML5视频教程

免费

独孤九贱(6)_jQuery视频教程

免费

独孤九贱(7)_Bootstrap视频教程

免费

独孤九贱(2)_CSS视频教程
初级 独孤九贱(2)_CSS视频教程

229605次学习

收藏

科技资讯

更多

精选课程

更多
前端入门_HTML5
前端入门_HTML5

共29课时

61.7万人学习

CSS视频教程-玉女心经版
CSS视频教程-玉女心经版

共25课时

39.3万人学习

JavaScript极速入门_玉女心经系列
JavaScript极速入门_玉女心经系列

共43课时

70.9万人学习

独孤九贱(1)_HTML5视频教程
独孤九贱(1)_HTML5视频教程

共25课时

61.6万人学习

独孤九贱(2)_CSS视频教程
独孤九贱(2)_CSS视频教程

共22课时

23万人学习

独孤九贱(3)_JavaScript视频教程
独孤九贱(3)_JavaScript视频教程

共28课时

33.9万人学习

独孤九贱(4)_PHP视频教程
独孤九贱(4)_PHP视频教程

共89课时

125万人学习

关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号