settting the background color of an iframe




17 years ago
3 months ago


(Reporter: rvj, Assigned: eric)



Firefox Tracking Flags

(Not tracked)


(Whiteboard: INVALID?)


(3 attachments)



17 years ago
Seem unable to set the background color of a XUL iframe. Should this currently 
work ?

<iframe id='window'  src="url" style="background-color:red;" />

If I load a short document (xml or gif) an implicit white background of a 200px 
is created.

Ihave tried using the computed style height to return the actual height of the 
document but it is not sufficiently accurate to dynamically adjust the iframe  
height e.g. it cuts off the last table row to a greater or lesser extent.
What would you expect setting the background color of an iframe to do?  The
entire contents of the iframe are another document, which has its own background.

Comment 2

17 years ago
First of all let me state that this is a xul question.

I am trying to get rid of the current white space (iframe canvas?) which occurs 
when the content of a document is smaller than the default iframe height.

I would expect it to set the underlying background color of the iframe,  not 
the document, which as you say has its own color background.

This white space problem goes way if I can set the height of the iframe exactly 
to the height of the document. 

But as I said earlier getcomputedstyleheight for the document is currently not 
accurate enough so I lose the bottom edge.

So back to your question - I would expect it to set the background color of the 
iframe (canvas)in an identical manner to setting the background color of the 
window (canvas). 

<window style="">


function setbackground()
     // get document background color
     // set iframe background color  }


<iframe style="" />



Comment 3

17 years ago
Created attachment 54391 [details]
iframe background color testcase

Comment 4

17 years ago
Created attachment 54392 [details]
iframe background color testcase

Comment 5

17 years ago
Created attachment 54393 [details]
icon for test case

Comment 6

17 years ago
apologies for duplicate testcase attachment

testcase to show example of document content/height less than iframe height but 
no ability to change iframe canvas color

the same problem occurs with other iframe src's for example xml+css documents 
which do not fill the iframe
->HTMLFrames, although it's not clear whether this should actually work
Assignee: dbaron → pollmann
Component: Style System → HTMLFrames
QA Contact: ian → amar


17 years ago
Attachment #54391 - Attachment mime type: text/plain → application/xml


17 years ago
Attachment #54392 - Attachment mime type: text/plain → application/xml


17 years ago
Attachment #54391 - Attachment mime type: application/xml → text/plain
Assignee: pollmann → evaughan
Whiteboard: INVALID?

Comment 9

17 years ago

While in the past it may have been an unsupported property for html pages, I 
would suggest that as an XUL widget it should be provided to be consistant with 
all other XUL widgets.

Otherwise there is no means of removing the white space.

Comment 10

17 years ago

I assume that when bug 105821 is resolved that the CSS background-color 
property will be used to set transparency. So for example if a short xml 
document does not fill the xul iframe flex area, the XUL window color will be 

<WINDOW  style="background-color:red">
<IFRAME  flex="1"  src="http://../small.xml" style="background-

I assume that the same approach will apply for other background colors

<IFRAME   src="http://../small.xml" style="background-color:red"/>

Any chance of this being implimented as a partial interim solution? 

i.e. it appears that fixing iframe transparency is substantially  more complex 
and is not expected before 1.0 at earliest

I'm marking this INVALID because a real solution has landed. See bug 50623 for
more information.
Last Resolved: 17 years ago
Resolution: --- → INVALID

Comment 12

17 years ago
OK but this makes it impossible to set the background of an iframe 
independently of the canvas?

For example, if an iframe is used to display to overlay a gif with transparent 

<iframe style="background-color:red" src="overlay.gif" />

It seems that only the <iframe> element which will have this limitation?

The remaining fix for bug 50623, which I will check in today or tomorrow, will
fix "background-color" on IFRAMEs so that everything you want to do will work :-).


4 months ago
Product: Core → Core Graveyard
Component: Layout: HTML Frames → Layout: Images
Product: Core Graveyard → Core
You need to log in before you can comment on or make changes to this bug.