zoukankan      html  css  js  c++  java
  • IE浏览器中iframe背景BODY透明

    IE浏览器中iframe会出现默认的白色背景及边框,影响美观。有边框的正常,但IE默认的HTML背景色为白色,而FF默认背景色为透明色。
    此外iframe在IE中长宽为300*150,其中边框为2px宽;FF 中为304*154,边框也同样为2px。(这里所说宽算边框的宽度)
    现有两个文件:main.html 和t ransparentBody.html
    其中transparentBody.htm是嵌套在main.htm之中,为了便于看效果在BODY中加入蓝色背景请看效果图:

    main.html代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>main</title> </head> <body style="background-color:blue;"> <iframe name="main" src="transparentBody.htm"></iframe> </body> </html>
    ransparentBody.html代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>transparentBody</title> </head> <body> ... </body> </html>
    首先,在transparentBody.htm的<body>中设定style="background-color:transparent",即为透明样式
    然后,在<iframe name="main" src="transparentBody.htm"></iframe>之中加入   frameborder="0"和allowTransparency="true"
    <iframe name="main" src="transparentBody.htm" frameborder="0" allowTransparency="true"></iframe> 到此,iframe背景透明效果搞定。
    代码中
    allowTransparency指是否允许透明,
    frameborder="0"是指边框为不可见。
  • 相关阅读:
    jmeter察看结果树中文乱码解决办法
    使用postman测试接口
    使用Jenkins持续集成
    Python单元测试unittest测试框架
    使用类封装一个签名规则
    Python处理URL编码
    Python中的 if __name__ == '__main__' 是什么意思?
    python发送邮件
    instruction 寻址,sib modrm
    .sv 与.svh之间的区别
  • 原文地址:https://www.cnblogs.com/ahjesus/p/1998653.html
Copyright © 2011-2022 走看看