By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,342 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,342 IT Pros & Developers. It's quick & easy.

Cross browser compatibility using offsetWidth

P: n/a
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
Share this Question
Share on Google+
1 Reply

P: n/a


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 discussion thread is closed

Replies have been disabled for this discussion.