Html 使用CSS更改引导工具提示样式

Html 使用CSS更改引导工具提示样式,html,css,twitter-bootstrap,bootstrap-4,tooltip,Html,Css,Twitter Bootstrap,Bootstrap 4,Tooltip,我已经安装并运行了Bootstrap4.5.0,但正在调整工具提示的样式。下面的代码 在页面顶部,我包括样式表: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8W

我已经安装并运行了Bootstrap4.5.0,但正在调整工具提示的样式。下面的代码

在页面顶部,我包括样式表:

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <link rel="stylesheet" href="https://getbootstrap.com/docs/4.5/assets/css/docs.min.css">

    <link href="mystylesheet.css" rel="stylesheet">
上面背景的变化只是一个例子。除了颜色之外,我还需要其他CSS类型的更改。

如中所述

.tooltip
元素是在触发的元素外部生成的。大概是这样的:

<!-- HTML to write -->
<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>

<!-- Generated markup by the plugin -->
<div class="tooltip bs-tooltip-top" role="tooltip">
  <div class="arrow"></div>
  <div class="tooltip-inner">
    Some tooltip text!
  </div>
</div>
$('#example').tooltip({
    html: true,
    title: 'xyz',
    template: `
        <div class="custom-tooltip tooltip">
            <div class="tooltip-inner"></div> /* leave it blank so the title will fill in dynamically here by bootstrapjs */
        </div>
    `
});
但这将对所有工具提示应用样式。如果您只需要元素的特定样式,请执行以下操作:

<!-- HTML to write -->
<a href="#" data-toggle="tooltip" title="Some tooltip text!">Hover over me</a>

<!-- Generated markup by the plugin -->
<div class="tooltip bs-tooltip-top" role="tooltip">
  <div class="arrow"></div>
  <div class="tooltip-inner">
    Some tooltip text!
  </div>
</div>
$('#example').tooltip({
    html: true,
    title: 'xyz',
    template: `
        <div class="custom-tooltip tooltip">
            <div class="tooltip-inner"></div> /* leave it blank so the title will fill in dynamically here by bootstrapjs */
        </div>
    `
});
在这里查看更多信息

.tooltip
{
    background-color: green !important;
}
$('#example').tooltip({
    html: true,
    title: 'xyz',
    template: `
        <div class="custom-tooltip tooltip">
            <div class="tooltip-inner"></div> /* leave it blank so the title will fill in dynamically here by bootstrapjs */
        </div>
    `
});
.custom-tooltip {
    /* your styles here */
}