Link to home
Start Free TrialLog in
Avatar of azaram
azaram

asked on

iframe scrollbars - vertical only?

Hi,
Just a simple question on iframes...
I'm currently testing with ie6 and when the content extends below the bottom of the iframe, I get both vertical and horizontal scrollbars.
Is there any way to make it just show the vertical scrollbar?
I've tried scrolling="vertical" and it does the same thing as no setting (auto).
ASKER CERTIFIED SOLUTION
Avatar of BogoJoker
BogoJoker

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jessegivy
You're likely getting the horizontal scrollbar because there is content in your iFrame that doesn't fit within the dimensions of your iFrame.  If you can ensure that the width is less than that of your iFrame the horizontal bar will disapear.  Post code and I'll lookat it if you'd like, tables can expand and cause unpredictable widths.
Joe has provided a much more excellent solution above, but keep in mind that any content that is hidden and would require scrolling horizontally will be unreachable and could look weird and cut-off.
Avatar of BogoJoker
BogoJoker

Jessegivy is correct and I fully remember typing that but I must have erased that when I edited my comment.  Thanks jessegivy!
Avatar of azaram

ASKER

jessegivy, the content was definitely not extending too far horizontally. Like Bogo said, it's a bug in IE6 that puts up both scrollbars, not just the one that is required.
Avatar of azaram

ASKER

Bogo... yeah I think I saw that originally too.

Anyway, thanks, you nailed it.. added the style section below into the head of the iframe source page and it solved it.
Note that adding those style tags to the style of the iframe itself didn't work.
Thanks!!!

<style>
html {
      overflow-x: hidden;
      overflow-y: auto;
}
</style>
That is surprising to me that you did have to add it using html { }.

However adding to html { } should be fine considering horizontal scrolling is considered very bad practice, it ranks number 3 on this list of top 10 bad web design things:
http://www.fenclwebdesign.com/bad-design.htm

And in your case above this wasn't your fault, just IE getting a little too happy with scrollbars.

Thanks for the grade,
- Joe P