Foundation prompt box


The prompt box is displayed after the mouse moves over the element:

We can add the data-tooltip attribute to any element to create prompt information. Use the title attribute to set the text of the tooltip.

Note: The slider requires JavaScript. So you need to initialize oundation JS:

Instance

<!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 style="padding:20px;">

<h2>提示框</h2>
<span data-tooltip title="php中文网">鼠标移到我这!</span>
<a href="#" data-tooltip class="button" title="www.php.cn">鼠标移到我这!</a>

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

</body>
</html>

Run instance»

Click the "Run instance" button to view the online instance

.has-tip Class can bold the text moved by the mouse:

Example

<!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 style="padding:20px;">

<h2>Tooltips</h2>
<span data-tooltip title="php中文网">鼠标移到我这!</span>
<span data-tooltip class="has-tip" title="php中文网">鼠标移到我这!</span>

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

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance


The prompt box display location

By default, the prompt box will appear in The bottom of the element.

You can use .tip-top, .tip-left, .tip-right or .tip-bottom (default) to set the position of the prompt box.

Note: On small screen sizes, the width of the tooltip is 100%.

Instance

<!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 style="padding:20px;">

<h2>提示框</h2>
<p>默认情况下,提示框会出现在元素的底部。</p>
<p>可以使用 <code>.tip-top</code>, <code>.tip-left</code>, <code>.tip-right</code> or <code>.tip-bottom</code> (默认) 来设置提示框的位置。</p>
<p><strong>注意:</strong> 在小尺寸的屏幕上,提示框的宽带是 100%。</p>
<span data-tooltip class="has-tip tip-top" title="php中文网!">顶部</span>
<span data-tooltip class="has-tip tip-bottom" title="php中文网!">底部</span>
<span data-tooltip class="has-tip tip-left" title="www.php.cn">左边</span>
<span data-tooltip class="has-tip tip-right" title="www.php.cn">右边</span>

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

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance


Rounded corner prompt box

.radius and .roun

Instance

<!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 style="padding:20px;">

<h2>圆角提示框</h2>
<p> <code>.radius</code> 和 <code>.round</code> 类用于设置圆角提示框:</p>
<span data-tooltip class="has-tip" title="php中文网!">默认</span>
<span data-tooltip class="has-tip radius" title="php中文网!">圆角</span>
<span data-tooltip class="has-tip round" title="php中文网!">圆形</span>

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

</body>
</html>

Run Example»

Click the "Run Example" button to view the online example

d class is used to set the rounded corner prompt box :