문제

I have a page with a yellow background. Now I add an Iframe to it including a different page on the same domain which has a white background. When I look at my Iframe now it has taken the background color of the yellow page! What I want is the Iframe to simply show exactly the other page, just like a window without changing any colors or anything.

What do I have to do to achieve this?

My code: <iframe src="http://www.example.com/page.php"></iframe>

도움이 되었습니까?

해결책

Browsers other than Internet Explorer give iFrames a transparent background if the pages contained within them have no explicit background settings. In order to overcome that, simply set the background color of the iFrame to white (which is the default background color).

iframe
{
 background-color: white;
}

If the page indeed sets a background color (now or in the future), this code would simply not have any visible effects.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top