Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed Advice On Simple CSS Tooltip
    text
    copied!<p>I need some advice on a simple CSS tooltip. I have a calendar on a site that is rendered within a table. People can add events to this calendar. I have added CSS so that when you hover over a date, it will display the event, or events for that date. Within the table, I have this for each date cell with an "event":</p> <pre><code>&lt;td class="eventDate" id="2011-08-24" title="2011-08-24"&gt; 24 &lt;span class="tooltip"&gt; &lt;img class="infoImg" src="./images/info.png" width="16" height="16"&gt; &lt;i&gt;Today's Events&lt;/i&gt;: &lt;br&gt; &amp;#149; This is an event. &lt;span class="noOfDays"&gt;[ 3 days ]&lt;/span&gt; &lt;/span&gt; &lt;/td&gt; </code></pre> <p>And, this is what I have for my CSS (found the technique via a Google search):</p> <pre><code>td.eventDate { position: relative; z-index: 24; background-color: #afafaf; color: #000; padding: 2px 4px 2px 4px; text-align: right; font-size: 36px; font-family: Georgia; } td.eventDate:hover { z-index: 25; cursor: default; } td.eventDate span.tooltip { display: none; } td.eventDate:hover span.tooltip { display: block; position: absolute; top: 5.3em; left: 28.5em; width: auto; color:#3e3e3e; border:1px solid #3e3e3e; background-color: #efefef; padding: 4px 8px 4px 8px; font-family: Candara, Tahoma, Geneva, sans-serif; font-size: .4em; font-weight: 700; text-align: left; z-index: 100; } span.noOfDays { font-size: 11px; padding: 0px 0px 0px 6px; } </code></pre> <p>This works perfectly for any Mozilla based web browser; however, when I move to Safari, Chrome or IE (I haven't tried it in Opera yet), it is all wonky. For one thing. the size of the tooltip box seems constrained to the size of the table cell, making my events wrap all over the place. Also, the positioning of the tooltip box when it is "revealed" seems relative to the table cell in which the event span is placed, and not aligned with the top-right of the calendar table.</p> <p>Can anybody see what I am doing wrong? Should this not be working in Mozilla either? Are there any other very simple, and lightweight tooltip techniques I can use that you would suggest? I was trying to stay away from JavaScript/JQuery/etc. as I wanted to keep this pretty light, but I may have to switch over if I cannot get this to work with CSS. Any, and all advice is appreciated.</p> <p>Thanks for taking the time to read, and have a great day. :-)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload