Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Bootstrap 4 提示框


Bootstrap 4 提示框

提示框组件是一个小的弹出框,当用户将鼠标指针移动到元素上时会出现。

将鼠标悬停于我之上

如何创建提示框

要创建提示框,请向元素添加 data-toggle="tooltip" 属性。

使用 title 属性指定应在提示框内显示的文本

<a href="#" data-toggle="tooltip" title="Hooray!">将鼠标悬停于我之上</a>

注意:提示框必须使用 jQuery 初始化:选择指定的元素并调用 tooltip() 方法。

以下代码将启用文档中的所有提示框

示例

<script>
$(document).ready(function(){
  $('[data-toggle="tooltip"]').tooltip();
});
</script>
亲自尝试 »

提示框定位

默认情况下,提示框将出现在元素的顶部。

使用 data-placement 属性设置提示框在元素顶部、底部、左侧或右侧的位置

示例

<a href="#" data-toggle="tooltip" data-placement="top" title="Hooray!">悬停</a>
<a href="#" data-toggle="tooltip" data-placement="bottom" title="Hooray!">悬停</a>
<a href="#" data-toggle="tooltip" data-placement="left" title="Hooray!">悬停</a>
<a href="#" data-toggle="tooltip" data-placement="right" title="Hooray!">悬停</a>
亲自尝试 »

完整的 Bootstrap 提示框参考

有关所有提示框选项、方法和事件的完整参考,请访问我们的 Bootstrap JS 提示框参考


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.