【发布时间】:2020-06-26 14:26:27
【问题描述】:
我一直在尝试将表格放在图标内的工具提示中,主要目标是创建一个小图例,使用黄色/橙色的 icon 来解释这些 colors 的含义。
到目前为止,我只设法使图标出现,但没有进一步成功。我现在在“颜色”列中制作的表格只显示颜色的名称,但我想显示一个小方块,用代表颜色的颜色绘制,即红色方块代表红色,蓝色蓝色的正方形......等等。
这是我编写的代码:
<style>
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 180px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
</style>
<a>
<span class="tooltip">
<i class="fas fa-info-circle"></i>
<table class="tooltiptext">
<thead>
<tr>
<th>Color</th>
<th>Significado</th>
<tr>
</thead>
<tbody>
<tr>
<th>Gris</th>
<th>Comprado</th>
</tr>
<tr>
<th>Verde</th>
<th>Emergencia</th>
</tr>
<tr>
<th>Verde</th>
<th>Urgencia</th>
</tr>
<tr>
<th>Verde</th>
<th>Urgencia Menor</th>
</tr>
<tr>
<th>Verde</th>
<th>Sin Urgencia</th>
</tr>
</tbody>
</table>
</span>
</a>
编辑:这里有一点snippet。
【问题讨论】:
-
你能分享演示吗
-
@vadivela 我有this,我正在尝试导入 fontawesome,因为图标还没有显示。编辑:图标现在显示。
标签: html css twitter-bootstrap html-table tooltip