2014-10-22 48 views
0

我剛剛注意到我的元素在iframe元素之後沒有在瀏覽器中呈現。 下面是代碼:爲什麼元素在iframe後被刪除

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8" /> 
</head> 
<body> 
    <div class="xpto"> 
     <iframe id="myIframe" src="http://www.google.com/custom?q=&btnG=Search" height="500px" width="100%"/> 
    </div> 
    <div class="footer"> 
     something 
    </div> 
</body> 
</html> 

jsfiddle

有誰知道這是爲什麼?

是我刪除了iframe一切工作正常!

+0

你能添加相關的CSS嗎? – 2014-10-22 10:02:47

+0

@AmanuelNega看起來不像是一個css問題,因爲它不包括非現場來源。 – 2014-10-22 10:05:42

回答

3

使用</iframe>,而不是在自身內結束元素標籤,它是<tag />

<div class="xpto"> 
 
    <iframe id="myIframe" src="http://www.google.com/custom?q=&btnG=Search" height="500px" width="100%"></iframe> 
 
\t </div> 
 
\t <div class="footer"> 
 
\t \t something 
 
\t </div>

0

如果關閉標籤,它會顯示頁腳

<iframe id="myIframe" src="http://www.google.com/custom?q=&btnG=Search" height="500px" width="100%"> 
</iframe> 
0

你應該通過標記關閉iframe。

這裏正在撥弄,

FIDDLE

<iframe id="myIframe" src="http://www.google.com/custom?q=&btnG=Search" height="500px" width="100%"></iframe> 
相關問題