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 8821719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:55:33+00:00 2026-06-14T05:55:33+00:00

When you apply border-collapse: collapse; to a table to meld its cells’ borders together,

  • 0

When you apply border-collapse: collapse; to a table to “meld” its cells’ borders together, it starts causing problems in determining the widths of table cells in Javascript. For example, look at this page:
http://game-point.net/misc/browserTests/scratchpads/jsTableWidth/
There are two tables, one with collapsed borders and one without. If you click on a row in the one without collapsed borders, jQuery’s innerWidth and outerWidth functions report what I would expect to see (the content width, and the content plus the border width respectively; there is no padding).

However, if you click on a row in the table with collapsed borders, you get browser-inconsistent behaviour, especially on the clientWidth property. In Firefox, clientWidth is the same as width(). In IE and Chrome, it’s 1 pixel higher, and in Opera, it’s the same as width(), but Opera’s width() is too small. In fact, the width() is one pixel too small in all the browsers I’ve tested except for Firefox. So if you take a screenshot and the content is actually 80px, width() is 79px (jQuery gets it from the calculated CSS value). Why is this?

I’m wanting to get the width of the actual content. I can’t seem to use width() because only Firefox gets that right with collapsed borders. I can’t use outerWidth() because that includes the borders (or maybe just one border, seeing as it’s only 1px larger than the actual content width). I can’t use clientWidth because its value is inconsistent between browsers. What should I do and why is width() 1px too short in most browsers when borders are collapsed?

  • 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-14T05:55:34+00:00Added an answer on June 14, 2026 at 5:55 am

    I think the problem in every browser but Opera is actually something jQuery is doing with its width() function; it has custom hooks for width and height and it doesn’t always return the true computed width. When I use window.getComputedStyle to get the widths of these table cells, it does indeed give me the proper rendered width. I am going to report Opera’s window.getComputedStyle output as a bug, because it doesn’t seem to give you the proper rendered width even when you bypass jQuery.

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

Sidebar

Related Questions

How do I apply a border around merged cells? (I don't mind if it
I'm trying to apply border-radius effect on a particular div. The code I used
when i apply this styles to option element: border-color: #8A8A8A #E5E5E5 #E5E5E5 #8A8A8A; border-style:
How do you apply a drop shadow to a specific border edge? For example,
I want to make a layout with a rounded border. How can I apply
I want to apply a 3px top left & top right radius border. How
Is their any way to apply a style resource to customize the Item Border
I want to apply different borders to image in my iphone application. I am
A border does not render when I apply a CSS border property to tfoot
i want to apply some css properties on last tr in table so i

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.