hadoob024 Posted April 23, 2008 Share Posted April 23, 2008 I've looked all over the web for solutions to this problem, but none of them seem to work properly. Either all the suggestions I saw were from 2005 and before and aren't applicable now (or are broken now with the latest browser updates), or they require making changes to the iframe source code (which I don't have access to). So anyway, is there a way to disable only the horizontal scrollbar in an iframe if you can't modify the source code of the iframe itself? I went with the: <iframe style = "overflow-x:hidden;overflow-y:scroll;" src = "blahblah.html"> </iframe> This works perfectly in firefox, but doesn't in any other browser. Any suggestions? Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/ Share on other sites More sharing options...
Spaceman-Spiff Posted April 23, 2008 Share Posted April 23, 2008 Correct me if I'm wrong, but I think overflow-x and overflow-y is not in CSS2 standards. This will be supported in CSS3, so older browsers may not support it. W3C CSS3 working draft: The 'overflow-x' and 'overflow-y' properties. Partially supported in Gecko 1.8, Safari 3, Opera 9.5, IE 7 (and below.) http://www.brunildo.org/test/Overflowxy2.html Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/#findComment-525223 Share on other sites More sharing options...
hadoob024 Posted April 23, 2008 Author Share Posted April 23, 2008 Hmmm... Then I guess I'm stuck for now then huh? I just tried it in Firefox 2.0.0.14, IE 7.0.6000.16643, Opera 9.25, and Safari 3.0.4, and it ONLY works properly in Firefox. Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/#findComment-525237 Share on other sites More sharing options...
Spaceman-Spiff Posted April 23, 2008 Share Posted April 23, 2008 That page I linked seems to be able to do it on IE7, but maybe it's a different case for <iframe> The sample was using overflow-y: auto; overflow-x: hidden; Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/#findComment-525265 Share on other sites More sharing options...
hadoob024 Posted April 23, 2008 Author Share Posted April 23, 2008 Hmmm, I wonder. Yeah, I put the style info directly in the IFRAME tag itself. Some people said to try putting the style info in the source of the iframe, but that's not a possibility. And if I put the style info in the BODY tag, then it removes the horizontal scrolling for the main window, and not the iframe part (which is what I wanted). I guess I'll just have to stick with hard coding in values for width/height. Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/#findComment-525282 Share on other sites More sharing options...
hadoob024 Posted April 24, 2008 Author Share Posted April 24, 2008 Someone suggested this to me which works perfectly, so I'm posting his solution here for everyone: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <title>Untitled 1</title> </head> <style type="text/css"> #test iframe { width: 800px; height: 4000px; border: none; } #test { width: 820px; height: 500px; padding: 0; border: inset 1px gray; overflow: auto; } </style> <body> <div id="test"> <iframe src="http://blahblahblah.html" scrolling="no"> </iframe> </div> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/102522-preventing-horizontal-scrollbar-in-iframe/#findComment-526066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.