What we did
November 2024 : How to anchor tool tips
This month we had a look at some articles on how to anchor tool tips using this article.
“CSS Anchor Positioning Guide” by Juan Diego Rodríguez
and “Popping Comments With CSS Anchor Positioning and View-Driven Animations”
Tool tips are little pop-up notes that appear at set places on a page to give the reader discreet information relating to the article being read. In my Landresearchnsw.info site I wrote some pages on the history of land titles. The articles have footnotes so I have experimented by placing comments at the subscript relating to the footnote using the code in the article.
I have increased the size and colour of the reference link to make them easier to see.
Here is the code used.
.tooltip {
position: relative;
display: inline-block;
border-bottom: 1px dotted black;
}
.tooltip .tooltiptext {
visibility: hidden;
content: " ";
top: 50%;
right: 100%; /* To the right of the tooltip */
width: 120px;
background-color: black;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 50%;
left: 100%;
margin-top: -5px;
border-width: 5px;
border-style: solid;
border-color: transparent transparent transparent black;
}
.tooltip:hover .tooltiptext {
visibility: visible;
}
Here are the test page results.
Steve South
Web Design leader