开发者

Picture on mouseover works but alignment?

I am trying to show an image on mouse over. It is working fine. But i get the picture shown up going downwards and the last picture takes away space in the bottom. For the last text that shows a picture on mouse over, i would like to have the picture's bottom to be close to the text and not the top.

HTML:

<td valign="middle" class="table_td td top" style="width: 347px">
    <span class="feature_text" style="cursor:poin开发者_Go百科ter" onMouseOver="ShowPicture('Style16',1)" onMouseOut="ShowPicture('Style16',0)" id="a16">Storefront Window Decal</span>
<div id="Style16" style="position:absolute; visibility:hidden; border:solid 0px #CCC; padding:5px">
    <img src="images/window-decal-image.gif">
</div>

JavaScript:

function ShowPicture(id,Source) 
{
    var vis, elem;

     if (1 == Source)
     {
     vis = "visible";
     }
     else if (0 == Source)
     {
      vis = "hidden";
     }
    else
    {
     throw new RangeError("Unknown Flag");
    }

    if (elem = document.getElementById(id))
    {
      elem.style.visibility = vis;
    }
    else
    {
      throw new TypeError("Element with id '"+id+"' does not exist.");
    }
     return vis;
    }

Thank you in advance..


While I agree with @epascerello's comment, have you tried position:absolute; bottom: 0px;?

EDIT:

Wait, that aligns the bottom of your tooltip to the bottom of its containing position: relative element. To align the bottom of your tooltip to the top of the container, use bottom: 100%.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜