I could probably spend a couple of hours and figure this out but I’m on a time crunch and am hoping to get some hints to point me in the right direction.
I have several nested divs with the inner one holding a data table that can get fairly wide. I’ve got overflow:auto on the outer div so the user can still access the data in the table at all resolutions. Problem is, on many (but not all) of these pages, the horizontal scroll is there even when it’s not necessary. There are 4 or 5 of us that have worked on these pages over a course of several years so the code is NOT consistent. Some divs have a width of 100%, some have 90%, some have fixed widths like 800px or 940px. Seems like the unnecessary horizontal scroll is appearing, regardless of what the width is. I’m hoping to clean up the code on all of these but so far, I can’t figure out how to get rid of that unnecessary scroll. I’d really like it to be set by the user’s resolution rather than give it a fixed width.
Anyone have any general ideas of what might be causing this to get me started?
It’s a healthcare application so I can’t let you into a live site because of HIPAA. Here’s a test site - the only problem is that it doesn’t have a lot of data:
Once you’re in, go to Tools > Reports. These are the pages I’m talking about - the reports that get generated when you click a report name on the left, then fill out the filters on the right and generate the report. I’m not sure how effective it will be since there’s so little data but this is just a test site so you’ll welcome to add anything you want. The unwanted scrollbars are appearing on most reports on the bottom right (i.e., where the actual report gets generated).
An example is the Account Activity by Client report. Choose client: “Jake Brown”, Date: Current Year.
That is brilliant. I’m not sure what padding you’re talking about. I tried removing all padding from the th and td on that table and the issue still exists. I tried adding a padding:0 to the table itself - scroll is still there. I even tried removing padding from the div that holds the table - but I still have a scroll.
Your issue works perfectly as is, but it does break other stuff and I’m not sure how to apply it to just the tables. I tried these things:
Those two make the h3 more that 100% wide, creating the scroll bar. So you can either address that by changing the padding to %, or apply the box-sizing rule to the h3: