【问题标题】:How do i remove all space between iframe and div elements?如何删除 iframe 和 div 元素之间的所有空间?
【发布时间】:2016-10-26 00:56:18
【问题描述】:

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

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>

【问题讨论】:

  • 您可以提供一个 jsfiddle 来演示您的问题。

标签: html css iframe


【解决方案1】:

你需要去掉&lt;h1&gt;标签的默认边距, 所有 HTML headings 都有默认的边距样式。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-27
    • 2014-09-15
    • 1970-01-01
    • 2014-08-29
    • 2017-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多