Reputation: 2690
I am using the following code to highlight the text segment in Codemirror, a code editor and syntax highlighter, downloaded from here.
I am not able to figure out from documentation how it is supposed to be implemented.
for (var i = 0; i < array.length; i++)
{
var range = array[i].split("-");
editor.getDoc().markText({
line: parseInt(range[0].split(":")[0]) - 1,
ch: parseInt(range[0].split(":")[1])
}, {
line: parseInt(range[1].split(":")[0]) - 1,
ch: parseInt(range[1].split(":")[1])
}, {
css: "color : white; background-color: red; border: 1px;"
});
}
Desired output (Not same as below, just for the clearance of concept)
Upvotes: 0
Views: 655
Reputation: 36
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 120px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
top: 120%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: -30%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent #555 transparent;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
<div class="tooltip">Wait.. Can you hover over me!
<span class="tooltiptext">Suprise!</span>
</div>
Source: https://www.w3schools.com/howto/howto_css_tooltip.asp
Upvotes: 2