国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > HTML > 正文

iframe背景透明的設置方法

2020-10-23 18:28:56
字體:
來源:轉載
供稿:網友

IE5.5開始支持浮動框架的內容透明。如果想要為浮動框架定義透明內容,則必須滿足下列條件。
1.與 iframe 元素一起使用的 allowTransparency 標簽屬性必須設置為 true。
2.在 iframe 內容源文檔,background-color 或 body 元素的 bgColor 標簽屬性必須設置為 transparent

復制代碼 代碼如下:

<iframe src="./ads_top_tian.html" allowtransparency="true" style="background-color=transparent" title="test" frameborder="0" width="470" height="308" scrolling="no"></iframe>

當然前提是iframe頁面中沒有設置顏色.
在上面我們主要是看到了style中的一句代碼style="background-color=transparent" 通過以下四種IFRAME的寫法我想大概你對iframe背景透明效果的實現方法應該會有個清晰的了解:
復制代碼 代碼如下:

<IFRAME ID="Frame1" SRC="transparentBody.htm" allowTransparency="true"></IFRAME>
<IFRAME ID="Frame2" SRC="transparentBody.htm" allowTransparency="true" STYLE="background-color: green"> </IFRAME>
<IFRAME ID="Frame3" SRC="transparentBody.htm"></IFRAME>
<IFRAME ID="Frame4" SRC="transparentBody.htm" STYLE="background-color: green"> </IFRAME>
 

現在我們來看一個實例
本例主要是iframe對象的allowTransparency屬性應用,在該屬性設置為true并且iframe所載加頁的背景顏色設置為transparent(透明)時iframe將透明化。
allowTransparency設置或獲取對象是否可為透明。
bgColor 設置或獲取對象的背景顏色

父頁面

復制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>父頁面</title>
</head>
<body bgcolor="#FF0000">
<iframe src="index.htm"  allowTransparency="true"></iframe>
</body>
</html>
 

子頁面

復制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>子頁面</title>
<style type="text/css">
body
{
    background-color: transparent;
}
</style>
</head>
<body>
</body>
</html>
 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 兴安县| 温泉县| 肃南| 勃利县| 洪泽县| 大兴区| 玛纳斯县| 广元市| 台湾省| 仪陇县| 新建县| 麻栗坡县| 新竹市| 余江县| 工布江达县| 孙吴县| 偃师市| 思南县| 海城市| 始兴县| 白朗县| 柏乡县| 宁津县| 新河县| 瑞昌市| 新昌县| 赤城县| 陇西县| 申扎县| 柏乡县| 新河县| 雷山县| 搜索| 徐闻县| 大悟县| 纳雍县| 余江县| 阿拉善右旗| 静海县| 灵石县| 阜新|