title: Super simple CSS tooltip in a table, why is it not displaying and can I make it work?
body: <p>I have been trying to implement many different tooltips on this page for my client, he's adamant that we have a picture of the product show up when you hover over the product name in the order page. I decided to use the super simple CSS tooltip, it's very easy to implement and does exactly what we want. It works on a dynamic page, the others I tried didn't.</p>
  
  <p>I have made an example here: <a href="http://jsfiddle.net/WNzhJ/" rel="noreferrer">CSS tooltip in table example</a>.&lt;-- <em>updated to remove errors</em>.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;table class="mytable" id="cart"&gt;
  
    &lt;tr id="titles"&gt;
      &lt;th id="varekodetext"&gt;Varekode&lt;/th&gt;
      &lt;th id="produkttext"&gt;Produkt&lt;/th&gt;
      &lt;th id="pristext"&gt;Pris&lt;/th&gt;
      &lt;th id="emptee"&gt;&amp;nbsp;&lt;/th&gt;
      &lt;th id="antalltext"&gt;Antall&lt;/th&gt;
      &lt;th id="pristotaltext"&gt;Pris Total&lt;/th&gt;
      &lt;th id="sletttext"&gt;Slett&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tbody&gt;
      &lt;tr class="even first" id="topborder" height="40px"&gt;
        &lt;td class="cart2Varekode"&gt; &lt;span&gt;39261-02 &lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="cart2Produkt"&gt; &lt;a href="/Plantronics-CS361N.11" target="_blank" class="tooltip" title="Plantronics CS361N"&gt; 
                  Plantronics CS361N
                  &lt;span&gt; 
                      &lt;img src="http://www.euroworker.no/public/upload/productimage/220-353-2.jpg" alt="Plantronics CS361N" /&gt; 
  
                  &lt;/span&gt; 
                  &lt;/a&gt;
          &lt;p&gt;
          &lt;/p&gt;
        &lt;/td&gt;
        &lt;td class="cart2Price"&gt;
          &lt;span class="actualPrice"&gt;2390.-&lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="cart2Salg"&gt;
          &lt;span class="orderlistPrice"&gt;&lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="antallbox"&gt;
          &lt;span class="cartQuant"&gt;&lt;input name="item_1363" class="DG-spinner" id="text" type="text" value="1"/&gt; &lt;span class="cartUpdate"&gt;&lt;button type="submit" class="submit" id="rfrsh_btn" name="saveFields" title="Oppdater" value=""&gt;&amp;nbsp;&lt;/button&gt;&lt;/span&gt;
          &lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="cart2Total"&gt;
          &lt;span class="basePrice"&gt;2390.-&lt;/span&gt;&lt;span class="actualPrice"&gt;2390.-&lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="delete"&gt;
          &lt;a class="slett" href="../..//order/delete/1363?return=" title="Slett"&gt;Remove&lt;/a&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="odd last" id="topborder" height="40px"&gt;
        &lt;td class="cart2Varekode"&gt; &lt;span&gt;7050-20&lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="cart2Produkt"&gt; &lt;a href="/Target-7050CC-Duo-UNC.7" target="_blank" class="tooltip" title="Target 7050CC Duo UNC"&gt;Target 7050CC Duo UNC&lt;span&gt;
        &lt;img src="upload/productimage/7-250-2.jpg?1251022192" alt="Target 7050CC Duo UNC" /&gt;               
                  &lt;/span&gt; 
                  &lt;/a&gt;
  
          &lt;p&gt;
            &lt;div class="productOptions" style="color:#b2b2b2;"&gt;
  
              &lt;div class="nonEditableOption"&gt;
                Skal tilkobles: Alcatel IP Touch
              &lt;/div&gt;
  
              &lt;div class="productOptionsMenu"&gt;
                &lt;a style="color:#6c8aa2;" href="/order/options/1377" ajax="/order/optionForm/1377"&gt;Endre valg&lt;/a&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  
          &lt;/p&gt;
  
        &lt;/td&gt;
        &lt;td class="cart2Price"&gt;&lt;span class="actualPrice"&gt;899.-&lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="cart2Salg"&gt;
          &lt;span class="salg" title="Rabatt"&gt;&amp;nbsp;&lt;/span&gt;
  
          &lt;span class="orderlistPrice" title="Opprinnelige prisen"&gt; 
                      (1599.-)
                  &lt;/span&gt;
        &lt;/td&gt;
        &lt;td class="antallbox"&gt;
          &lt;span class="cartQuant"&gt;&lt;input name="item_1377" class="DG-spinner" id="text" type="text" value="1"/&gt; 
  
                      &lt;span class="cartUpdate"&gt;&lt;button type="submit" class="submit" id="rfrsh_btn" name="saveFields" title="Oppdater" value=""&gt;&amp;nbsp;&lt;/button&gt;&lt;/span&gt;
          &lt;/span&gt;
        &lt;/td&gt;
  
  
        &lt;td class="cart2Total"&gt;
  
          &lt;span class="basePrice"&gt;899.-&lt;/span&gt;&lt;span class="actualPrice"&gt;899.-&lt;/span&gt;
  
        &lt;/td&gt;
        &lt;td class="delete"&gt;
  
          &lt;a class="slett" href="../..//order/delete/1377?return=" title="Slett"&gt;Remove&lt;/a&gt;
  
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="6" class="cols-six"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr id="topborder-tr"&gt;
        &lt;td class="subTotalCaption2"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td colspan="4" class="subTotalCaption2"&gt;Mva (25%):&lt;/td&gt;
        &lt;td class="amount taxAmount2"&gt;822.-&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  
  
  
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td class="subTotalCaption2"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td colspan="4" class="subTotalCaption2"&gt;Totalt:&lt;/td&gt;
        &lt;td class="subTotal2"&gt;4111.-&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
  
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="5"&gt;&lt;/td&gt;
        &lt;td class="cartQuant"&gt;&lt;/td&gt;
        &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td colspan="7"&gt;
          &lt;a href="/" class="continueShopping"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;
          &lt;div class="checkoutButtons"&gt;
            &lt;a href="/checkout" class="proceedToCheckout" onclick="return Order.submitCartForm(this);"&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/a&gt;
  
          &lt;/div&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
      &lt;script type="text/javascript"&gt;
        new Order.OptionLoader($('cart'));
  
      &lt;/script&gt;
  
    &lt;/tbody&gt;
  
  &lt;/table&gt;
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>.cart2Produkt a:hover {
    background: #ffffff;
    text-decoration: none;
    z-index: 999;
  }
  
  /*BG color is a must for IE6*/
  
  .tooltip {
    text-align: left;
  }
  
  .cart2Produkt a.tooltip span {
    z-index: 999;
    display: block;
    position: absolute;
    left: -999px;
    opacity: 0;
    padding: 2px 3px;
    margin-left: 8px;
    width: 130px;
    -webkit-transition: opacity;
    -webkit-transition-timing-function: ease-in;
    -webkit-transition-duration: 500ms;
  }
  
  .cart2Produkt a.tooltip:hover span {
    z-index: 999;
    display: block;
    position: absolute;
    right: 50%;
    opacity: 1;
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #6c6c6c;
    top: -35px;
    left: -15px;
    z-index: 10;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    text-align: center;
    vertical-align: middle;
    padding: 1px;
    -webkit-transition: opacity;
    -webkit-transition-timing-function: ease-out;
    -webkit-transition-duration: 500ms;
  }
  
  
  /**************IGNORE BELOW*************/
  
  #topborder {
    /*border-top: 1px #ccc solid;*/
    padding-bottom: 10px;
  }
  
  #topborder-tr {
    border-top: 1px #ccc solid;
  }
  
  .mytable {
    width: 100%;
    margin-bottom: 20px;
  }
  
  .mytable,
  .mytable th,
  .mytable tr,
  .mytable td {
    border: 0;
    letter-spacing: 1px;
  }
  
  .mytableborders,
  .mytableborders th,
  .mytableborders tr,
  .mytableborders td {
    border: 1px #ccc solid;
    /*width:670px;*/
  }
  
  .mytable td,
  .mytable td span {
    padding-bottom: 0;
    padding-top: 5px;
    /*border-top: 1px #ccc solid;*/
    vertical-align: middle;
    font-size: 12px;
  }
  
  .mytable th {
    vertical-align: bottom;
    height: 30px;
    padding-bottom: 5px;
  }
  
  #titles {
    margin: 0px auto 0px auto;
    width: 100%;
    padding-bottom: 50px;
    z-index: 1;
    border: 1px #ccc solid;
    border-left: none;
    border-right: none;
  }
  
  .cart2Produkt a {
    color: #0a5692;
    text-decoration: none;
    line-height: 15px;
    clear: both;
    z-index: 999;
  }
  
  productOptionsMenu {
    clear: both;
  }
  
  #pristotaltext p,
  #varekodetext p,
  #sletttext p,
  #pristext p,
  #antalltext p,
  #produkttext p {
    font: 12px/11px "Helvetica";
    margin: 0px;
    color: #828273;
    text-align: left;
  }
  
  #thinline,
  #thinlinecopy {
    background: url(../../upload/thinline.png) no-repeat;
    visibility: visible;
    position: absolute;
    left: 0px;
    z-index: 4;
    width: 747px;
    height: 1px;
  }
  
  #thinlinefakt {
    background: url(../../upload/thinline.png) no-repeat;
    visibility: visible;
    position: absolute;
    top: 100px;
    left: 0px;
    z-index: 4;
    width: 747px;
    height: 1px;
  }
  
  #thinlinefakt2 {
    background: url(../../upload/thinline.png) no-repeat;
    background-position: bottom;
    visibility: visible;
    position: absolute;
    top: 205px;
    left: 0px;
    z-index: 4;
    width: 747px;
    height: 28px;
    margin: 5px;
    margin-left: 10px;
    margin-top: 0px;
    padding: 5px;
    color: #000000;
    font-size: 22px;
    font-family: "Helvetica";
  }
  
  .Fadresse {
    display: block;
    margin: 5px;
    padding: 0;
    color: #000000;
    font-size: 22px;
    font-family: "Helvetica";
  }
  
  #thinlinecopylever {
    background: url(../../upload/thinline.png) no-repeat;
    background-repeat: repeat-x;
    position: relative;
    left: 0px;
    top: -3px;
    width: 100%;
    height: 1px;
    padding: 0px;
  }
  
  #varekodetext {
    width: 65px;
    padding-left: 5px;
    text-align: center;
  }
  
  #produkttext {
    width: 150px;
  }
  
  
  /*#sgproductview  {
  
  margin: 0px auto 0px auto;
  width: 595px;
  height:1%;
  z-index:1;
  }*/
  
  #thinlinecopy {
    top: 1px;
  }
  
  #antalltext {
    width: 25px;
    text-align: center;
  }
  
  #pristotaltext {
    width: 10%;
    text-align: right;
  }
  
  #sletttext {
    width: 10%;
    text-align: center;
  }
  
  #thinline {
    top: 19px;
    position: absolute;
  }
  
  #pristext {
    width: 24px;
    text-align: center;
  }
  
  #emptee {
    background-color: none;
    width: 40px;
  }
  
  
  /*****************************************CONTENT*/
  
  .cart2Produkt p,
  .cart2Varekode p,
  .cart2Salg p {
    font: 13px/11px "Helvetica";
    margin: 0px;
    letter-spacing: 1px;
    text-align: left;
  }
  
  .cart2Produkt p a {
    color: #000000;
  }
  
  .cart2Total p {
    font: 13px/11px "Helvetica";
    margin: 0px;
    letter-spacing: 1px;
    text-align: left;
    color: #000000;
  }
  
  .cart2Varekode {
    visibility: visible;
    z-index: 2;
    text-align: center;
    vertical-align: top;
    padding-top: 3px;
    font-weight: bold;
  }
  
  .cart2Produkt {
    visibility: visible;
    text-decoration: none;
    text-align: left;
    position: relative;
    width: 28%;
    font-weight: bold;
    padding-bottom: 2px;
  }
  
  .cart2Produkt a {
    white-space: nowrap;
  }
  
  .cart2Price {
    visibility: visible;
    z-index: 2;
    text-align: right;
    width: 6%;
    position: relative;
    font-weight: bold;
  }
  
  .cart2Price p {
    font: 13px/11px "Helvetica";
    margin: 0px;
    letter-spacing: 1px;
    text-align: right;
    width: 80%;
  }
  
  .cart2Total p {
    font-weight: bold;
    text-align: right;
  }
  
  .cart2Salg p {
    color: #B2B2B2;
    width: 20%;
  }
  
  .cart2Total {
    visibility: visible;
    z-index: 2;
    text-align: right;
    font-weight: bold;
  }
  
  .antallbox {
    white-space: nowrap;
    text-align: center;
  }
  
  .antallbox input {
    text-align: right;
    outline: none;
    width: 30px;
  }
  
  .antallbox input:focus {
    text-align: right;
    outline: none;
    border: 1px #000 solid;
    background-color: #F0F7FD;
  }
  
  .cartQuant {
    width: 30px;
    /*    white-space: nowrap;*/
    text-align: left;
    margin-top: 5px;
  }
  
  .cart2Salg {
    visibility: visible;
    z-index: 2;
    padding: 0;
    margin: 0;
  }
  
  .orderlistPrice {
    text-decoration: line-through;
    font-weight: bold;
    color: #b2b2b2;
    font-size: 12px;
  }
  
  .salg {
    background: url(../../upload/salg.png) no-repeat;
    visibility: visible;
    z-index: 2;
    width: 28px;
    height: 24px;
    display: inline-block;
    position: relative;
  }
  
  .delete {
    visibility: visible;
    z-index: 2;
    height: 21px;
    background: none;
    text-align: center;
  }
  
  .slett {
    width: 24px;
    height: 19px;
    background-image: url(../../upload/delete_box_sprite.png);
    background-position: 0 0;
    text-decoration: none;
    display: inline-block;
  }
  
  .slett:hover {
    width: 24px;
    height: 19px;
    background-image: url(../../upload/delete_box_sprite.png);
    background-position: -24px 0;
    text-decoration: none;
    display: inline-block;
  }
  
  .productOptions {
    background-color: #fff;
    postion: absolute;
    visibility: visible;
    display: block;
    top: 3px;
    padding-left: 5px;
    padding-bottom: 10px;
  }
  
  .nonEditableOption {
    background-color: #fff;
    float: left;
    postion: absolute;
    margin-right: 10px;
    visibility: visible;
    display: block;
  }
  </code></pre>
  
  <p>This page used to be displayed using divs, I have since changed it to a table, as it's tabular data and easier to work with. It worked fine when it used divs, now it's in a table, it won't display the span on hover. </p>
  
  <p>My questions are: </p>
  
  <ol>
  <li><p>Why is it not working? </p></li>
  <li><p>How can I make it work?</p></li>
  <li>If not, does anyone
      know another super easy to implement
      tooltip that can work properly on a
      dynamic page?</li>
  </ol>
  
  <p>Here's the DIV tooltip for reference: <a href="http://jsfiddle.net/waFC8/" rel="noreferrer">DIV display tooltip</a>.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;div id="JSwrap"&gt;
      &lt;div id="cart2Produkt"&gt;
          &lt;p&gt;&lt;a href="/Target-7050-Softphone-USB-Duo.220" target="_blank" class="tooltip" title="Target 7050 Softphone USB Duo "&gt;Target 7050 Softphone USB Duo
      &lt;span&gt;&lt;img src="http://www.euroworker.no/public/upload/productimage/220-353-2.jpg?1251413379" alt="Target 7050 Softphone USB Duo " /&gt;
  &lt;br /&gt; 
    &lt;/span&gt; 
  &lt;/a&gt;
          &lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>#JSwrap {
    /*for jsfiddle only*/
    position: absolute;
    left: 100px;
    top: 50px;
  }
  
  #cart2Produkt {
    border: 1px solid #ccc;
    width: 500px;
    text-align: left;
    padding: 10px;
  }
  
  #cart2Produkt a.tooltip span {
    z-index: 999;
    display: block;
    position: absolute;
    left: -999px;
    opacity: 0;
    padding: 2px 3px;
    margin-left: 8px;
    width: 130px;
    -webkit-transition: opacity;
    -webkit-transition-timing-function: ease-in;
    -webkit-transition-duration: 500ms;
  }
  
  #cart2Produkt a.tooltip:hover span {
    z-index: 999;
    display: block;
    position: absolute;
    right: 50%;
    opacity: 1;
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #6c6c6c;
    top: -35px;
    left: -15px;
    z-index: 10;
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    text-align: center;
    vertical-align: middle;
    padding: 1px;
    -webkit-transition: opacity;
    -webkit-transition-timing-function: ease-out;
    -webkit-transition-duration: 500ms;
  }
  
  #cart2Produkt img {
    z-index: 999;
  }
  </code></pre>
  
  <p><strong>Edit</strong>: Just noticed it  half works in IE8.</p>
  
  <p><strong>Update:</strong> It's now working in all browsers, thanks to Daniel pointing out my CSS errors, but is there a way to make it display outside of the table cell?</p>