Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iFrames & Scrolling 1

Status
Not open for further replies.

kizmar2

Programmer
Joined
May 25, 2004
Messages
164
Location
US
Using iframes... with "scrolling=verticle" (or auto for that matter)... Firefox works fine... when I view the page in IE, it's displaying a horizontile scroll bar when it shouldn't be.

It appears to me that IE doesn't calculate the width of the verticle scroll bar into the <table width=100%> width, so the src page is always that much wider then the display area of the iframe.

Any fixes for this? If I shrink the inner page small enough so it displays correctly in IE, there's all kinds of open space on the right in FF.

KizMar
------------
 
Option 1: Get rid of the doctype.

Option 2:
In screen containing iframe:
Code:
<div align="center">
<!--[if IE]>
ie 
<iframe src=iframe.htm width="300" height="200" 
scrolling="yes"</iframe>
<![endif]-->

<!--[if !IE]>
not ie 
<iframe src=iframe.htm width="300" height="200" 
scrolling="auto"></iframe>
<![endif]-->

and in the iframe color the scroll bar so it blends in to the background:
Code:
<style type="text/css">
html {scrollbar-face-color:white;
      scrollbar-shadow-color:silver;
      scrollbar-highlight-color:silver;
      scrollbar-3dlight-color:white;
      scrollbar-darkshadow-color:silver;
      scrollbar-track-color:white;
      scrollbar-arrow-color:silver}
</style>

Clive
 
Correction:
1st piece of code should be:
Code:
<!--[if IE]>
<iframe src=iframe.htm width="400" height="200" scrolling="yes"></iframe>
<![endif]-->

<!--[if !IE]>-->
<iframe src=iframe.htm width="400" height="200"
scrolling="auto">
</iframe>
<!--[endif]-->

Clive
 
You probably have a doctype something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"<html xmlns=" xml:lang="en" lang="en">

If you replace it with <html> you will be operating in what is known as quirks mode. In that mode IE does not mess up the scroll bars. This is not really a recommended solution but for simple mark-up it would be ok. You would only have to remove the doctype of the iframe. The second option is better and a 3rd option would be to use scrolling="yes" and still change the color of the scroll bars for IE users.

Hope that helps!



Clive
 
Well the doc type thing didn't work... but the other did the trick. Thanks for the help.

KizMar
------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top