html - 加载时更改 iframe 的背景

标签 html css iframe

<分区>

Possible Duplicate:
Can I change or control the color of the IFRAME area before the content loads?

我在 div 中有一个带有背景色的 iframe。加载页面时,iframe 占位符变为白色。有什么方法可以在加载 iframe 时更改背景?

提前谢谢你。

最佳答案

也许是这样

<iframe src="http://www.google.com/" width="500" height="400" style="background-color: red;"></iframe>

有用吗?

您还可以为 iFrame 指定一个类或 ID,并为其指定 CSS 样式。

对于图像:

<iframe src="http://www.google.com/" width="500" height="400" style="background-image: url('http://www.google.co.uk/intl/en_uk/images/logo.gif');"></iframe>
  • 巴里

关于html - 加载时更改 iframe 的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2714251/

上一篇:html - 处理可变内容边距的最佳实践方法?

下一篇:ruby-on-rails - 无论支架宽度如何,都强制我的 div 扩展

相关文章:

javascript - 在弹出窗口中显示更多文本

javascript - 使用javascript的球动画

html - Bootstrap 4 : hidden-md-up not working

css - 我可以根据 less/xCss 中的其他变量定义变量吗

HTML 电子邮件背景图片

javascript - 比 iframe 更好的替代品来显示选项卡内容?

php - 从Embed iframe获取YouTube图片

jquery - 从具有相同类别的组中单击的元素

javascript - 单击导航栏时如何禁用刷新背景图像?

javascript - 从另一个域获取 iframe 的内容