使用一个css文件更改iframe中的正文背景颜色 [英] Change body background color in an iframe using one css file
问题描述
使用iframe从我的网站空间中调用网站,使用一个css文件与 body {background-color:#222}
。
Using a iframe where I call a site from my webspace, Using one css file with body {background-color: #222}
.
iframe src也使用这个CSS文件。问题是,iframe中的正文需要另一个背景颜色。
The iframe src also use this CSS file. The Problem is that the body in the iframe need another background-colour.
尝试
iframe>body { background-color: #other }
任何想法或建议?
推荐答案
我假设iframe占用了您网站的较小部分。在这种情况下,我建议你只需使用一个大小相同的iframe加载,并给这个div适当的背景颜色。
I assume the iframe takes up a smaller portion of your site. In that case I would advice you to simply use a div with the same size of the iframe is loaded, and giving this div the proper background-color.
OR:include iframe页面源代码中的样式属性:
OR: include a style property in the source of the iframe page:
<head>
<style>body {background-color:#COLOR}</style>
</head>
这篇关于使用一个css文件更改iframe中的正文背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!