473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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!

Jul 23 '05 #1
1 2962


pa******@hotmail.com wrote:
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.


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.offsetWidth 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
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Simba | last post by:
In some pages of my website I use a code like the following: for (var n = 0; n < getTagsArray("SPAN").length; n++){ //SPAN is just an example. I also use other tags tag =...
1
by: Ned Baldessin | last post by:
Hi, I have reimplemented the non-standard <marquee> element (in a very simplified fashion), moving around a DIV using offsetParent and offsetWidth. It works fine in Mozilla (1.7.5) and Safari...
17
by: Mark Rae | last post by:
Hi, I'm interested in your opinion concerning how far you would consider it necessary to code for cross-browser compatibility these days, especially for public-facing Internet sites... ...
2
by: Lüpher Cypher | last post by:
Does anyone know of good links about cross-browser compatibility (html attributes/css2/javascript)? -- - lüpher --------------------------------------------- "Man sieht nur das, was man...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
2
by: cooldudevamsee | last post by:
HI fellows, How can I get visible viewport dimensions of any browser ?
2
by: dwair | last post by:
Hi, I have been having browser compatibility issues and was wondering if anyone could help. I have been using a JavaScript array to populate marker data using ASP JS in a google Maps project. For...
13
by: Jeff | last post by:
We have an intranet website that currently uses ActiveX but we need to make it cross-browser compatible and also get around the problems we've been having with making it work with IE7 and Vista. We...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.