从Customizr主题的网页中删除上边距

时间:2015-01-05 20:54:16

标签: html css wordpress

我是一个WordPress新手。 我在Customizr-Child主题上运行我的网站(使用Child Themify插件http://wordpress.org/plugins/child-themify/)。 当我尝试在网页中编写html代码时,页面顶部似乎有不必要的边距,例如。 http://www.resourcematics.com/ag-tool/ 我想摆脱这个上边缘。

我的孩子主题外观>编辑器选项卡只有style.css文件。

有人可以指导我,如何解决这个问题! 提前致谢, ANKIT

3 个答案:

答案 0 :(得分:0)

首先,请确保通过在其顶部添加css代码来重置您的css代码

* {
   margin : 0;
   padding: 0;
}

如果您这样做,并且保证金仍然存在,请确保代码顶部没有任何<h1><h2>,因为它们的默认边距看起来像它的body margin-top

如果有任何尝试为他们创建一个类,例如title 然后将其添加到您的css文件

.title {
   margin : 0;
   padding: 0;
}

答案 1 :(得分:0)

它实际上不是边际而是边界。

 .tc-header {  
border-bottom: 10px solid #e9eaee;
border-top: 5px solid #27cda5;
}

答案 2 :(得分:0)

[编辑]

因此,根据对该问题的澄清,这是我通过打开浏览器开发人员检查工具发现的内容。查看内容容器中生成的HTML:

<div class="entry-content">
    <p>
        <br><br><br>
        <meta charset="utf-8">
        <!-- P tag with line break BR tags and meta tag -->
    </p>

    <p>
        <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"><br>
        <script src="https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.js"></script>
        <!-- P tag with meta tag and script tag -->
    </p>
    <link href="https://api.tiles.mapbox.com/mapbox.js/v2.1.4/mapbox.css" rel="stylesheet">
    <style>
        body { margin:0; padding:0; }
        .map-info { font-size: 20px; }
        #map { position: relative; width: 100%; height: 500px; }
    </style>

    <p>
        <br>
        <!-- P tag with line break BR tag -->
    </p>

    <div>
        Our GIS based agriculture water demand model is of 5 X 5 arc minutes (approximately 9 X 9   kilometres at the equator) resolution.
    </div>

    <p>
        Following maps show <b>area irrigated by country in hectares around year 2010</b>. The map was developed based on <a href="http://www.uni-frankfurt.de/45218039/Global_Irrigation_Map">Siebert <i>et. al.</i>, 2005</a> and Resourcematics’ Agriculture Water Model
    </p>
</div>

我们可以得出什么结论?简单。

  1. P标记:浏览器会在每个P标记元素之前和之后自动添加一些空格(边距)。 Source

  2. BR标签(在P标签内):几乎不言自明。添加换行符。

  3. 生成地图的插件:插件似乎添加了所有的脚本,css和响应元数据(就像你在html的HEAD部分中所做的那样)页面)直接在您的内容容器中。他通过在我们上面提到的P标签中附上它的内容来做到这一点(这是一个很好的猜测,但看似合理)。

  4. 将(S):

    • 如果我是你,我会先检查你是否偶然添加了 在正文之前的WYSIWYG编辑器中不必要的换行符。
    • 我会考虑使用和测试其他Map插件和 看它是否解决了这个问题。