how to measure width/height px of a DIV or SPAN?

Discussion in 'CSS' started by Labcoat88, May 19, 2006.

  1. #1
    I have a <span> with style="display:none". When the user mouses over an icon, some javascript sets the display:block... it's sort of like a tooltip. What I need to do is to absolutely position the <span> on the page based on the size/dimensions of the block. The hitch is that sometimes the block is just a few words, but most other times it contains several paragraphs of text. Is there a way to detemine the pixel height/width of a span block so I an position it accordingly?

    thanks
    LC
     
    Labcoat88, May 19, 2006 IP
  2. JudyJiaStyle

    JudyJiaStyle Well-Known Member

    Messages:
    139
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    108
    #2
    I'm not sure I understand. If you want to place it in an absolute position, why should it matter how big the block would be if it's going to be in the same place? To me, absolute position is regardless of other elements on the page.

    Do you have an example of what you're trying to do? Off the top of my head, I'd say use a percentage width/height so it's relative to the block.
     
    JudyJiaStyle, May 19, 2006 IP