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"是指边框为不可见。
  • 相关阅读:
    Knowledge point
    Nagios详解(基础、安装、配置文件解析及监控实例)
    配置网络yum源
    springsecurity整合springboot实现简单认证授权
    使用openssl生成rsa密钥对
    springsecurity实现记住我功能
    springsecurity生成图形验证码并校验
    springsecurity开发基于表单的认证--个性化用户认证流程
    springSecurity自定义用户认证逻辑
    关于JWT分析的文章转载
  • 原文地址:https://www.cnblogs.com/ahjesus/p/1998653.html
Copyright © 2011-2022 走看看