Cross browser compatibility using offsetWidth

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • parksch2@hotmail.com

    Cross browser compatibility using offsetWidth

    I know there are a lot of articles out there about this subject but I
    have been reading for 3 hours and still can't find the answer. I have
    some text in a bunch of hidden spans. I need to find the width in
    pixels of that text. Using offsetWidth gives me a different value when
    viewed in IE and Firefox. I need those to sync up somehow. I have tried
    innerWidth, clientWidth, scrollWidth, etc. Any ideas?

    Thanks in advance!

  • Martin Honnen

    #2
    Re: Cross browser compatibility using offsetWidth



    parksch2@hotmai l.com wrote:
    [color=blue]
    > I know there are a lot of articles out there about this subject but I
    > have been reading for 3 hours and still can't find the answer. I have
    > some text in a bunch of hidden spans. I need to find the width in
    > pixels of that text. Using offsetWidth gives me a different value when
    > viewed in IE and Firefox.[/color]

    Why not, browsers can have different defaults for font-family and
    font-size, padding, margin, the browser windows can have different
    dimenisions. In one browser window element.offsetW idth should give you
    the correct pixel width for that element but don't expect to get the
    same value in another browser window.


    --

    Martin Honnen

    Comment

    Working...