Forum Moderators: open

Message Too Old, No Replies

IFRAME horizontal scrollbar disable

need to get rid of the horizontal scroll on my iframe

         

drnknblackcoffee

5:06 pm on Sep 28, 2004 (gmt 0)

10+ Year Member



I have an IFRAME that works perfect on MAC browsers. But the HORIZONTAL SCROLLBAR appears on PC browsers. I would like to disable the HORIZONTAL SCROLLBAR. my code looks like so...

<iframe name="mainf" src="home.html" height="556" width=100% marginheight="0" marginwidth="0" frameborder="0" scrolling="auto"></iframe>

I know while (scrolling="auto") is there it will scroll, but because i have the (width="100%") the HORIZONTAL SCROLLBAR doesn't appear, in theory and on MAC ie and safari.

BlobFisk

10:13 am on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi drnknblackcoffee,

I may be missing the point, but would useing scrolling="no" solve your problem?

drnknblackcoffee

2:51 pm on Sep 29, 2004 (gmt 0)

10+ Year Member



nope that just dissables both scroll bars, i just want to dissable the horizontal bar, and keep the verticle.

isitreal

4:53 pm on Sep 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



you're looking for this I think, can't remember if that works on iframes though:

however, you need to make sure that your iframe content doesn't go beyond the right edge of its container in that case. The other option is to physically size the iframe content page to less than the width of the iframe.

iframe {
overflow-x: hidden;
overflow-y: scroll;
}

drnknblackcoffee

2:32 pm on Sep 30, 2004 (gmt 0)

10+ Year Member



thanks, how would that fit into my script i have above?

ballygobackwards

3:14 pm on Sep 30, 2004 (gmt 0)

10+ Year Member



<style type="text/css">
iframe {
overflow-x: hidden;
overflow-y: scroll;
}
</style>

drnknblackcoffee

8:12 pm on Sep 30, 2004 (gmt 0)

10+ Year Member



would i put that in my body tag?

(never used css before)

ballygobackwards

8:32 am on Oct 1, 2004 (gmt 0)

10+ Year Member



it goes in your <head> tag

drnknblackcoffee

5:47 pm on Oct 1, 2004 (gmt 0)

10+ Year Member



i used that css code. didnt work.

the scroll bars were still there.

I researched CSS and understand it, built some test sites just to make sure i was doing things correctly.

iframe {
overflow-x: hidden;
overflow-y: scroll;
}
didnt work.

the only thing that worked was

iframe {
overflow: hidden;
}

which took off both bars, i need the verticle.

tedster

6:23 pm on Oct 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest looking at the content of the documents that appear in the iframe. If those pages really fit, at least visibly, then you may have run into a relatively complex IE rendering oddity.

Try two experiments with a FRAMED page (not the framing page.) First is to switch the rendering into quirks mode by removing the DTD, or at least the URL portion of the DTD. If that eliminates the scroll bar, you are suffering from this IE scrollbar "bug".

The second, look for any element that fills the entire width of the framed page and has width=100%. Especially (since <p> tags default to 100% width) try adding a style rule like this: p {width:95%}

Playing around in this fashion you may get a feel for what is forcing IE to show a horizontal scrollbar in your case. But again, I feel the fix will be found in the framed pages, not the framing page. And unfortunately, this bug is not easy to identify - maybe 20% of the time it doesn't appear when it seems like you would expect it.

kaled

11:33 am on Oct 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've just stumbled across a similar problem with regular frames (used in an uncommon way). However, if I remove the doctype the horizontal scrollbar vanishes. It makes no difference what the contents of the doctype statement are, any garbage will cause the problem to appear.

I'm still trying to find a fix (other than removing the DTD).

The problem seems to be related to the vertical scrollbar. If no vertical scrollbar is required, the horizontal scrollbar also vanishes.

Kaled.

kaled

2:39 pm on Oct 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Further research.....

According to MS documentation, an unrecognised doctype will select standards mode - hence one observation above.

There are also changes in standards mode to width calculations and body and html relevance, so with a little experimentation, I found that body { width:98% } will cause the horizontal scrollbar to vanish if placed in the content page.

This may work with IFrames too but the smaller the frame, the smaller the % value is required. This will also depend on the width of the scrollbar.

[msdn.microsoft.com...]

Kaled.

isitreal

3:40 pm on Oct 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I had a site with full iframes, xhtml 1 doctype, I didn't get the bottom scroll bar ever, except for one instance, when I used <pre> tags and the pre content was wider than the iframe.

Only Opera had scrollbars left and bottom always, but that's a default behavior, no way to get rid of it that I know, nothing to do with how something is coded.

Bottom scroll bars on iframe or frames doesn't happen if you make sure that widths are not explicitly declared anywhere on the content pages, this means just let the elements flow naturally, hx tags, p, divs, just let them fit themselves to the size of the container, I never saw this kind of problem when I used those methods.

The iframe or frame window acts pretty much exactly the same as a standard browser window, if you set the width of p as 100%, and then add padding to the p, it's going to force a bottom scroll bar, since then the width is 100% + the padding, which is > 100%, ergo scroll bar.

kaled

7:36 pm on Oct 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, I've found a solution to my problem that will probably apply equally well to IFrames.

A doctype is required that causes IE to work in quirks mode. With HTML 4.01 trans this is as simple as deleting the url from the doctype. The code can still be validated, it just affects rendering.

Assuming that the contents of the IFrame are simple, this should not cause any problems. And, so far as I can tell, unless you are specifying both the width/height and margin/padding/border of an element, there should not be much of a problem.

For XHTML, etc. see the link below
[hut.fi...]

Kaled.

drnknblackcoffee

4:57 pm on Oct 4, 2004 (gmt 0)

10+ Year Member



Well... I have done a controlled experiment to try and find the problem behind the horizontal scroll bars.

Its simple, if you are using dreamweaver any code writing program on a MAC OSX or higher, your document will work correctly ONLY on MAC browsers... ( i have used the CSS, DTD, JAVA and so on)

If you are using a PC with the same exact software your code will work perfectly on PC and MAC browsers. ( for this i didnt do anything except make the SRC document 20 pix smaller)
and it worked fine on all browsers)

Im sad to say Macs arnt perfect after all.

kaled

5:34 pm on Oct 4, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assuming your scrollbars are 16 pixels wide, a reduction of 16 pixels instead of 20 would probably have worked.

Kaled.