使用一个css文件更改iframe中的正文背景颜色 [英] Change body background color in an iframe using one css file

查看:508
本文介绍了使用一个css文件更改iframe中的正文背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆