View Full Version : iframe color

05-18-2007, 06:22 AM
I'm using an iframe for a photo gallery. The website is black and when an image comes up that is smaller than the frame there is white all around it. Is there a way to have the excess space around the image black?


05-19-2007, 01:02 AM
I just happen to be looking for the same thing and found this thread.
IFrame scroller/Change scrollbar style/colour? 10-12-2004, 07:25 AM
May I suggest that you do a search for this thread and read the articles. I hope this solves your query (and mine).

The bottom paragraph is interesting:

<style type="text/css">
body {

Change the colors to anything.
just mess around with it.

05-19-2007, 03:00 AM
Further to the above this DynamicDrive code from the CSS Library works great for changing the color of scrollbars. However, it does not affect the color of the frame, title bar or status bar. Pity! Here I am still searching and experimenting.
<style type="text/css">

05-19-2007, 03:26 AM
TimeTracker: The css code you posted only works in IE (Internet Explorer) and only affects the scrollbars (as you have already said). There is no css or javascript code that could manipulate the way the end user sees the Title or Status Bar of the browser. There are several threads about why you shouldn't try to "take over" the browser with your design, and to only use the defined amount of space in the browser window. Have a look through those.

Hope this helps.

05-20-2007, 04:16 AM
I'm using an iframe for a photo gallery. The website is black and when an image comes up that is smaller than the frame there is white all around it. Is there a way to have the excess space around the image black?


The display behavior of an image itself (one not on a page) inside an iframe varies significantly among browsers. For consistency, the image in the iframe needs to be on a page in the iframe. You can then set the background color of that page to whatever you like, including transparent. For transparency to work for this in IE though, the iframe must have its allowtransparency attribute set to true.

<iframe allowtransparency="true" src="photo1.htm" width="300" height="300" scrolling="auto" frameborder="1"></iframe>

05-20-2007, 05:12 AM
I was thinking about this a bit more. If you don't want to make a page for each image, you could do something like so:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
body {
a {
<script type="text/javascript">
function pageIt(el, im){
var f=window.open('',el);
f.document.write('<body style="background-color:transparent;"><img src="'+im+'"><\/body>');
return false;
return true;
onload=function(){pageIt('bob', 'photo1.jpg')};
<iframe name="bob" allowtransparency="true" src="photo1.jpg" width="300" height="300" scrolling="auto" frameborder="1"></iframe><br>
<a href="photo2.jpg" target="bob" onclick="return pageIt(this.target, this.href);">Photo 2</a>

05-20-2007, 09:35 AM
John: So I found out. However, for my purposes IE 7 is proving ideal. With full screen there is no title bar nor status bar to worry about and the scrollbars have been coloured. I have also been able to combine an iframe script with a scrolling script and then color the borders, even black them out. The effect is stunning and very practical and works in Mozilla 1.5, Netscape 7 and IE 7. Furthermore I can set a dozen links or more to fill the iframes (absolute popup) one at a time (jtricks.com).
The purpose of the 'darkness' is to highlight the effect of the binary slides, now seen through a viewer with a glossy interior (so there is no real darkness). Thanks to your help it is now possible for me to create my own stem cells using the energies of time. I am now in day 42 of the treatment program and know that it is working. People can see the results already. Until patents are in place the how will remain my secret.

05-21-2007, 12:36 AM
Very interesting. I hope that you are also under a doctor's care.

05-23-2007, 12:21 AM
Actually, John, I am not under any doctor. This is not something they understand, nor are they qualified to advise, since it is completely new and pioneering research. However, I am in touch with the federal minister for health's office. My scoliosis is almost gone, a spoon back disappearing and along with it lumbar pain. Yesterday I spent over forty-five minutes in a dentist's chair and experienced no dizziness nor fainting. I was able to get up and go home like I used to do when I was a young man. For the past week I have slept without a neck support collar, to which I was a prisoner for over six years. On Thursday I start Stage Four of the treatment, learning as I go.
In forty five days some amazing things have happened. Probably the next time I visit my doctor will be to tell him I am cured of arthritis and a wry neck. I certainly am looking forward to it. Here there are no drugs involved, no invasive medical procedures, no negative side effects and it is completely DIY. Each day I thank the Lord for restoring my health. Cheers.