View Full Version : Style background inside IFRAME

06-02-2012, 11:24 AM

Is it possible to style a background of a HTML page which is requested in the iframe?

This because im making a video gallery for a client.
Whenever he adds a new video, a completely new HTML file is generated with a white background color.

I then request it in my iframe with

<iframe src="videogal/vidgal.html" frameborder="0" width="600" height="700"></iframe>

I want the white to be transparent, but its hard for my client to edit the original html file each time he uploads a new video.

Thanks in advance,

06-02-2012, 06:22 PM
Whatever is generating the page just needs to do the body tag as:
<body style="background-color:transparent;">

Or include a stylesheet with that as a rule.

If the pages are being served from the same domain as the parent page, then you could probably do a scripted solution, but that would be rather excessive for such a simple problem.

Major Payne
06-03-2012, 01:34 PM
What you see as the white background may not be a background color being set by any CSS rule. A browser, by default, will show the color for web pages that the user has set in Options/Preferences. Even if you set the body tag to have a transparent color, the user's browser will just show its default color. If you link each page to an external CSS file, you can better control what the overall page looks like.

If you want the background of the iframe transparent, then set it with a CSS rule, but you'll still see the browser's default background color through the transparency. You could use CSS 3 for some great effects or make a small 1 X 1 px transparent or 25%-50% opaque image.