Thank you so much for this suggestion! It pointed me in the right direction, which is (as I understand it) to try to hold everything constant and start changing my code one piece at a time to try to identify what it is in my code that has been messing up my tooltips. Before I did that, however, I decided to see whether I could replicate the problems I am encountering on my web site in a brand new page using the model code exactly as I got it from the tutorial and without any of my existing styles. My logic: if I could not replicate the problems on the test page, that would mean that it was either something (1) I had introduced when adjusting the tooltip code for my purposes, or (2) something in my style sheet that was fighting with the code from the tooltip tutorial. If I was unable to replicate the problems, it would mean that I had to begin a process of trial and error to find out what in my code was messing up the tutorial code. If I was able to replicate the problem, it would mean that it was something in the tutorial code.
Well, I created a brand new page that used the tooltip tutorial code. That page is here: http://wildadirondacks.org/Tooltip-Test.html
As you can see, the problems I have been struggling with on my Starflower page were EXACTLY replicated on the test page.
Putting a tooltip in a paragraph resulted in an unwanted line. Putting a tooltip in an unordered list worked fine. (Same as in my Starflower page)
The tooltips on the test page worked fine on my desktop (all six browsers) and on two of my iPad browsers (Opera Mini and Firefox). The tooltips did not work at all on the iPad in either Chrome or Safari. (I touched the target text and nothing happened.)
So, following the logic outlined above, I conclude that the problem is probably in the tutorial code. I say "probably" because I might have unwittingly introduced something weird in the code when I cut and pasted into the test document. This is not my area of expertise; I am primarily a researcher and writer and making unwitting (but fatal) errors while coding is a way of life for me.
Why does the tutorial code from the W3Schools site work on iPad on Chrome and Safari? I don't know. It may be something in the W3Schools style sheet. Does the tutorial code work in plain old paragraphs for the tutorial pages on the W3Schools site? I don't know, because I could not find an example of a tooltip inside a para on the W3Schools site.
So, despite your useful suggestion that led to this experiment, I am still in need of help.
What can I do to the code on my Starflower page to make the tooltips work in (1) paragraphs (as well as unordered lists) and (2) in Chrome and Safari on my iPad?
Ellen
Here is my html:
<body style="text-align:center;">
<h2>Tooltip</h2>
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>
<p>This is paragraph one. In this paragraph, I am just going to type for a while, to demonstrate what a paragraph looks using the body style in the example provided at W3Schols. Just a plain old paragraph. It's going to be centered on the page, because that's the style set up in the example I am following. OK, now I am tired of typing, so I am going to end my pararaph.
</p>
<p>This is paragraph two. I am trying to see whether this tooltip will work inside a paragraph. So I am just going to type and type and type, and then eventually insert a tooltip, followed by more typing. Here is my tooltip: <div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div>OK, now I am going to type a little bit more, to finish my fake paragraph. As you can see, the tooltip inserts an unwanted line just before the tooltip target text. The tooltip itself works, but it has messed up my paragraph.
</p>
<p>Now, I am going to type in a second paragraph, followed by an unordered list, to see whether the tooltip will work with the unordered list: </p>
<ul>
<li> This is the first bullet of my unordered list. </li>
<li>This is the second bullet. </li>
<li>This is the third bullet. In this bullet, I am going to include a tooltip. Here is my tooltip: <div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip text</span>
</div> Thus ends my tooltip. </li>
<li>This is the fourth bullet. </li>
</ul>
<p>This is the rest of my paragraph. I am going to type in a few more sentence to fill out the paragraph. As you can see, the tooltip works perfectly inside an unordered list. It does what a tooltip is supposed to do, and it doesn't insert an unwanted line. This test page mirrors exactly what my<a href="adirondack-wildflowers-starflower-trientalis-borealis.html"> Starflower page</a> did when I tried to inserts tooltip in a paragraph. The tooltips inside an unordered list worked fine, but the tooltips inside a plain old paragraph inserted an unwanted line break. </p>
<p>One additional point: When I deployed this page to the server, and tried it on my iPad, the tooltips behaved exactly as they behaved on my Starflower page. That is, the tooltips appear obediently on touch with the Firefox and Opera Mini browsers, but do not appear at all with the Safari and Chrome browsers. </p>
</body>
</html>
Here is my css:
<style>
.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;
bottom: 125%;
left: 50%;
margin-left: -60px;
opacity: 0;
transition: opacity 1s;
}
.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>