views:

7106

answers:

10

Hello,

I have an iframe on www.mydomain.com that points to support.mydomain.com (which is a CNAME to a foreign domain). I automatically resize the height of my iframe so that the frame will not need any scrollbars to display the contained webpage. On Firefox and IE this works great, there is no scrollbar since I use <iframe ... scrolling="no"></iframe>. However, on webkit browsers (Safari and Chrome), the vertical scrollbar persists even when there is sufficient room for the page without the scrollbar (the scrollbar is grayed out). How do I hide the scrollbar for webkit browsers?

Thanks,

Ken

A: 

Can you set the overflow-y CSS property for the IFRAME to either visible or hidden?

JasonWyatt
Setting the overflow-y css property to hidden directly for the IFRAME, or for the html/body tags of the contained web page seems to have no effect. Could I be overriding this property somehow?
BrainCore
-1 `overflow-y` is not a standard CSS property; it is IE only.
Josh Stodola
Thanks for letting me know Josh!
JasonWyatt
Pretty sure overflow-y and overflow-x are correct CSS3...
Douwe Maan
A: 

I'm assuming you've tried this, but have you set scrolling to no on the iframe?

<iframe scrolling="no">
Shpigford
yup. I didn't escape that flag in my post, unfortunately, so it didn't display.
BrainCore
A: 

Try this...

iframe { overflow:hidden; }
Josh Stodola
Been trying it from the start. Not working. Thanks though.
BrainCore
+4  A: 

I just ran into this problem, and discovered that the fix was to set overflow: hidden on the HTML tag of the page inside the iframe.

Tim
Thanks for this tip, Tim; it fixed the issue for me.By the way, it seems like styling the HTML element to be overflow:hidden inside of a style tag doesn't work -- you need to put it in as a style attribute for the HTML tag (even though that's not valid). So...This: <html style="overflow: hidden;"> <head></head> <body>stuff</body> </html>Not this: <html> <head><style type="text/css"> html { overflow:hidden; } </style></head> <body>stuff</body> </html>
Rudi
A: 

check if the scroll is realy from the iframe, maybe it's from the HTML or BODY.

For scroll in iframe

<iframe scrolling="no">

In css

iframe { overflow:hidden; }

or 

iframe { overflow-x:hidden; overflow-y:hidden}
Razielblood
A: 

do not use scrolling tag at-all on the iframe and add the style as style="overflow-x:hidden;overflow-y:auto;" this will remove the horizontal scroll and it should work the other way round too.

-Jai

Jai
A: 

Does this help? Works on Chrome, IE, FF...

<style type="text/css">
html { overflow:hidden; }
#test { position:absolute; top:50; left:50; right:50; bottom:50; height:2000px; }
</style>

<body scroll="no">
<div id="test">content</div>
</body>
tpeck
A: 

I just solved it on my blog with scrolling="no" after the style tag.

eg:

iframe src="asdf.html" style="overflow: hidden;" scrolling="no"

I left the style attribute in there because it's more proper and it worked fine on Firefox.

Giles Bowkett
A: 

Setting the iframe's scrolling attribute to "no" should fix this, but there appears to be a bug in webkit: https://bugs.webkit.org/show_bug.cgi?id=29240

Tim's work-around ( http://stackoverflow.com/questions/1691873/safari-chrome-webkit-cannot-hide-iframe-vertical-scrollbar/1848336#1848336 ) seems to fix the issue -- as long as you have the ability to edit the document contained by the iframe...

Rudi
A: 

hide iframe scrolling in chrome put body tag like this

body style="margin:0px; padding:0px; overflow:hidden;"

Vaidehi