简体   繁体   English

可选择的工具尖端悬停元素

[英]Selectable tool-tip hovering an element

I know that this question is rather vague but I couldn't find much information regarding to my problem. 我知道这个问题相当含糊,但我找不到有关我问题的更多信息。 Basically, what I want to achieve, is a tool-tip that doesn't disappear when I hover it, allowing me to select its text. 基本上,我想要实现的是一个工具提示,当我将其悬停时它不会消失,允许我选择它的文本。

Is this possible or do I have to create a div simulating the tool-tip? 这是可能的还是我必须创建一个模拟工具提示的div

For instance: 例如:

<a id="foo">hover me</a>
<div class="box" id="tooltip">item 1<br/>item 2<br/>item 3<br/></div>

In this case, the div would appear as a tool-tip of foo . 在这种情况下, div将显示为foo的工具提示。

It can be done by using transition property: 可以使用transition属性来完成:

<style>
    .tooltip:after {
    opacity: 0;
    content: "";
    }
    .tooltip:hover:after { 
    opacity: 1;
    transition: opacity  0s linear 1s;
    content: " some text you want to keep ";
    }
</style>
<a href="#" class="tooltip">What am I?</a>

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

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