"Alexey Smirnov" <> wrote in message
news:05fb6005-d324-441b-b335-...
On Dec 9, 5:21 pm, "AAaron123" <aaaron...@roadrunner.com> wrote:
> A iframe element always shows white background in IE7.
>
> In Firefox it shows the color defined in the class attribute.
>
> Can I get IE7 to do likewise somehow?
>
> Thanks in advance
>
> I have the following in a context file:
>
> <asp:Content ID="Content2" ContentPlaceHolderID="RightCPH" runat="server">
>
> <div id="Div3" runat="server" class="MainMasterDataNormal" >
>
> <h5>ARTICLES </h5>
>
> </div>
>
>
<iframe name="ArticlesFrame" frameborder="0"
> class="MainFrame" height="533">
>
> </iframe>
>
> </asp:Content>
>
> The Style sheet file contains:
>
> .MainFrame
>
> {
>
> background-color: black;
>
> width: 95%;
>
> margin: 10px;
>
> }
>
> Which sets the margin and width OK but not the backgroung color.
>
> I can force the color by including:
>
> src="Make Black.htm"
>
> which has a black background, but I really want it to either use the class
> or else inherit from the container background color.
This is because background of the iframe is overlayed with background
of the source document. In your case you see the white document over
black iframe. To set the background use iframe's ALLOWTRANSPARENCY
attribute and set the background-color attribute of the BODY element
must be set to transparent.
Example:
main.htm
....
<iframe class="MainFrame" src="iframe.htm" ALLOWTRANSPARENCY="true"></
iframe>
....
iframe.htm
....
<body style="background-color:transparent">
....
OR you can also use javascript, for example
<script>
document.all.f.style.backgroundColor = "red";
</script>
where "f" is id of the iframe object (<iframe id="f"...
More about this
http://msdn.microsoft.com/en-us/library/ms535258.aspx
Hope this helps
=============
I had a bug in my post. I fixed above by removing
src="Make Black.htm"
from the iframe element.
You see how much that changes the problem?
There is no src value. The iframe opens without an overlay. When the user
makes a selection the attribute src is set equal to something.
So I tried to set the iframe background color to something pleasing until a
selection is made.
Thanks