简体   繁体   English

如何在 flexdashboard 导航栏图标中添加工具提示?

[英]How add tooltip in flexdashboard navbar icon?

I have this application in R .我在R有这个应用程序

How add tooltip when I hover over the icon?当我将鼠标悬停在图标上时如何添加工具提示? Like this:像这样:

在此处输入图片说明

The icon class is .fa-question-circle .图标类是.fa-question-circle I tried:我试过:

HTML: HTML:

<a href="#" class=".fa-question-circle" data-tooltip="My text is a text">Text</a>

CSS: CSS:

.fa-question-circle 
{
    position:relative;
}

.fa-question-circle:after
{
    background-color:rgba(0, 0, 0, .6);
    color: white;
    box-sizing:border-box;
    content: attr(data-tooltip);
    display:none;
    padding:5px;
    position:absolute;
    right: -105px;
    bottom: -55px;
    z-index:3;
    box-shadow: 0 0 3px #000;
    border-radius: 0px 10px 10px 10px;
}

.fa-question-circle:hover:after {
    display:block;
}

But doesn't work.但不起作用。 Thanks.谢谢。

I found the wrong part.我找到了错误的部分。 you need use class="fa-question-circle" not class=".fa-question-circle"你需要使用class="fa-question-circle"而不是class=".fa-question-circle"

 .fa-question-circle { position:relative; } .fa-question-circle:after { background-color:rgba(0, 0, 0, .6); color: white; box-sizing:border-box; content: attr(data-tooltip); display:none; padding:5px; position:absolute; right: -105px; bottom: -55px; z-index:3; box-shadow: 0 0 3px #000; border-radius: 0px 10px 10px 10px; } .fa-question-circle:hover:after { display:block; }
 <a href="#" class="fa-question-circle" data-tooltip="My text is a text">Text</a>

You can try something like this and remove .您可以尝试这样的操作并删除. from the class name in your anchor tag.来自anchor标记中的类名。

 .fa-question-circle { position: relative; display: inline-block; border-bottom: 1px dotted black; } .fa-question-circle .tooltiptext { visibility: hidden; width: 120px; background-color: black; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; /* Position the tooltip */ position: absolute; z-index: 1; } .fa-question-circle:hover .tooltiptext { visibility: visible; }
 <a href="#" class="fa-question-circle">Text <span class="tooltiptext">My text is a text</span> </a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM