运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap 示例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://www.w3schools.cn/lib/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
  <script src="https://www.w3schools.cn/lib/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container mt-3">
  <h3>工具提示定位</h3>
  <p>data-bs-placement 属性指定工具提示位置。</p>
  <a href="#" data-bs-toggle="tooltip" data-bs-placement="top" title="Hooray!">Top</a>
  <a href="#" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Hooray!">Bottom</a>
  <a href="#" data-bs-toggle="tooltip" data-bs-placement="left" title="Hooray!">Left</a>
  <a href="#" data-bs-toggle="tooltip" data-bs-placement="right" title="Hooray!">Right</a>
</div>
<script>
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
  return new bootstrap.Tooltip(tooltipTriggerEl)
})
</script>
</body>
</html>
×

报个问题: