css - Topmargin 0 不起作用?缓存问题?

标签 css wordpress margin

我似乎无法让我的 margin-top:0; 属性在我的样式表中工作。我不确定为什么,但是当我清除浏览器的缓存时,该属性将暂时起作用,然后立即返回并在我的页面顶部留出一个空间(看看:www.sunporchhomes.com)。我正在使用 Wordpress 进行构建。这是我的代码的上半部分,我们将不胜感激。

CSS

body
{
margin:0;
padding:0;
background-image:url("http://www.sunporchhomes.com/sphbg5.png");
}

a:link {color:#ffffff;}      /* unvisited link */
a:visited {color:#ffffff;}  /* visited link */
a:hover {color:#808080;}  /* mouse over link */
a:active {color:#ffffff;}  /* selected link */

a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:none;}
a:active {text-decoration:none;}

#logo {
    margin: 0;
    width: 1000px;
    z-index: 26;
}

.wrapper {
    min-height: 100%;
    height: auto !important;
    height: 100%;
    margin: 0 auto -50px; /* the bottom margin is the negative value of the footer's height */
}

#header {
    width: 1000px;
    height: 175;
    position: absolute;
    top: 0;
    left: 0;
    padding-left:70px;
}

#banner {
            position: absolute;
            top: 0px;
            left: 0px;
            right: 0px;
            width: 100%;
            height: 419px;
            z-index: -1;
        }

#navigationtable {
    position:absolute;
    padding-left:730px;
    z-index: 10;
    padding-top:20px;
}

HTML

<body>

<div id="wrapper" class="hfeed">

   <img id="banner" src="http://sunporchhomes.com/spmain1.png" alt="Banner Image"/>

       <div id="navigationtable">
<table class="tg" width="400">
  <tr>
    <th class="tg-lhfu"><a href="http://sunporchomes.com">HOME</a></th>
    <th class="tg-031e"></th>
    <th class="tg-031e"><a href="http://sunporchhomes.com/warranty.html">WARRANTY</a></th>
    <th class="tg-031e"></th>
  </tr>
 <tr>
    <th class="tg-lhfu"><a href="http://sunporchhomes.com/features-3.html">FEATURES</a></th>
    <th class="tg-031e"></th>
    <th class="tg-031e"><a href="http://sunporchhomes.com/faq-2.html">ROWHOME FAQ</a></th>
    <th class="tg-031e"></th>
  </tr>
 <tr>
    <th class="tg-lhfu"><a href="http://sunporchhomes.com/floor-plan-2.html">FLOORPLAN</th>
    <th class="tg-031e"></th>
    <th class="tg-031e"><a href="http://sunporchhomes.com/about.html">ABOUT US</a></th>
    <th class="tg-031e"></th>
  </tr>
 <tr>
    <th class="tg-lhfu"><a href="http://sunporchhomes.com/neighbourhood.html">NEIGHBOURHOOD</a></th>
    <th class="tg-031e"></th>
    <th class="tg-031e"><a href="http://sunporchhomes.com/contact.html">CONTACT</a></th>
    <th class="tg-031e"></th>
  </tr>

</table>
</div>

 <div id="boxplus">
 <img src="http://sunporchhomes.com/boxplus.png" />
 </div>

 <div id="logo">   
    <img src="http://sunporchhomes.com/splogo13.png" /> 

    </div>
 </div>

最佳答案

您遇到的问题不是您的 css,而是您的 WordPress 管理栏。

当您登录到 WordPress 时,它会尝试“强行”在浏览器窗口的顶部 32 像素处绘制一个管理栏。

当您的 css 与 WP 尝试执行此操作的方式发生冲突时(由于您大量使用 position: absolute,我相信您的 css 确实如此),您可以顶部留有空白,而不是管理栏。

您可以通过编辑您的用户配置文件并取消选中“查看网站时显示工具栏”来禁用管理栏

我已经在 Firefox、Chrome 和 Internet Explorer 中进行了测试 - 它们都能正确呈现您的网站,没有您描述的空间。

关于css - Topmargin 0 不起作用?缓存问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24414828/

相关文章:

css - Wordpress 中的 inline-css 在哪里

css - 为什么我的右边距与 IE 中的左边距重叠?

javascript - 如何将弹出窗口添加到此 flexslider

javascript - 在 WordPress 中使用 Jquery 和 css 区分两个相同的 HTML ID 元素

javascript - Scroll-lock/You click->你可以向下滚动

html - 设置表格行之间的边距

html - 如何删除 HTML 表格中行之间的分隔?

html - 3 种尺寸的图像列表

php - wordpress 从帖子内容中查找 iframe 代码

reactjs - 有没有办法在 WordPress Gutenberg 编辑器中添加新标签