Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8292971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:40:28+00:00 2026-06-08T13:40:28+00:00

Somehow I get different results for offsetWidth in Firefox and Chrome. I got a

  • 0

Somehow I get different results for offsetWidth in Firefox and Chrome.
I got a simple button

<button class="someClass">Dropdown<i class="iconRight iconArrowDown"></i></button>

which’s offsetWidth is exactly 89 Pixels. Chrome says so and Photoshop does too. Even in Firefox it is DISPLAYED as a 89 Pixel Element, but Firebugs offsetWidth says it has 90 Pixels. jQuery gets also 90 Pixels in Firefox for outerWidth().
As I use the width to calculate it needs to be exactly right.

  • sadly I’m not allowed to post images yet

Picture1 https://i.stack.imgur.com/2YMNt.png

Picture2
https://i.stack.imgur.com/HiH9o.png

Why is the offsetWidth property wrong in firefox?

EDIT from Comments:

I’m using a custom font. Disabling the font solves the problem. However testing this with a custom font on FF+Linux, FF+Win7 and Chrome+Win7 – Firefox on Windows 7 is the only Browser where the displayed width differs from the computed offsetWidth. Even though – due to font-rendering – the button has 91 Pixels on Linux, there is no problem in the calculations as the displayed width is the same. For now I probably simply have to live with that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T13:40:29+00:00Added an answer on June 8, 2026 at 1:40 pm

    Chances are the real width is a non-integer number of pixels between 89 and 90. When computing offsetWidth, the real width is rounded to nearest integer. When painting, what you see will depend on the exact antialiasing algorithms used and other factors.

    If you just want the actual width of the object, use getBoundingClientRect().width, which doesn’t do the silly "round to integer" thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

somehow I get never any results when I call: select * from table_1 t1
This somehow simple task is not so simple. I can get the number of
Is it possible to somehow get structure of MySQL database, or just some table
Can I get somehow(from a database or other source) a percentage of the phones
I have somehow managed to get a really screwed up Eclipse project. I have
I've been working all day and I somehow can't get this probably easy task
Somehow the linebreaks are not working as they should. This is what I get:
...well, I got strange results! I was curious about the performance of std::vector vs.
I need to return two different results in a single query. When I run
Somehow I can't get my UTF-8 sources to play nice with Ant. I get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.