2016-10-25 207 views
1

所以我一直试图删除我的div元素和iframe之间的空间,一个小时没有成功。任何帮助将不胜感激。这是我迄今为止所做的。如何删除iframe和div元素之间的所有空间?

CSS:

h1 { 
    text-align: center; 
    color: white; 
} 

.d1 { 
    border-style: none; 
    background-color: blue; 
} 

iframe { 
    width: 50%; 
    height: 50%; 
    display: block; 
    margin: 0; 
} 

这里是我的html:我想删除的顶部和底部的2级的div元素之间的空白。

<!DOCTYPE html> 
<!-- By Christian Soto --> 
<html> 
    <head> 
     <meta charset="UTF-8"> 
     <title>Event Driven JS</title> 
     <link rel="stylesheet" type="text/css" href="index.css"> 
    </head> 
    <body> 
     <div class="d1"> 
     <h1>Using JavaScript to Change the HTML</h1> 
     </div> 
     <iframe id="section"> 
     <!-- Will be loading different html pages into here --> 
     </iframe> 
     <div class="d1"> 
     <h1>Christian Soto</h1> 
     </div> 
    </body> 
</html> 
+0

你可以提供一个jsfiddle来演示你的问题。 – Steve

回答

2

您需要从<h1>标签删除默认的保证金, 所有HTML headings有一个默认的保证金风格。

h1{ 
text-align: center; 
color: white; 
margin: 0; 
} 
+0

啊,就是这样。非常感谢,先生。 –