Php 减少页眉图像上方的空白,而不考虑浏览器大小

Php 减少页眉图像上方的空白,而不考虑浏览器大小,php,html,css,header,Php,Html,Css,Header,我的网站是www.rostheexplorer.com 下面的代码在my header.php中 <img class="header-img" src="https://i2.wp.com/www.rosstheexplorer.com/wp-content/uploads/2017/02/Cover-Photo-6-2.jpg"> <img class="mobile-header-img" src="https://i2.wp.com/www.rosstheexplo

我的网站是www.rostheexplorer.com

下面的代码在my header.php中

<img class="header-img" src="https://i2.wp.com/www.rosstheexplorer.com/wp-content/uploads/2017/02/Cover-Photo-6-2.jpg">


<img class="mobile-header-img" src="https://i2.wp.com/www.rosstheexplorer.com/wp-content/uploads/2017/05/Cover-Photo-Mobile-Test.jpg">
在桌面上查看站点时,标题图像上方通常有空白。看起来,即使手机图像没有出现,空白区也几乎没有消失

如何确保页眉图像和页面顶部之间没有任何间隙


谢谢

您在
自定义css中有以下媒体查询:

@media screen and (min-width: 75em) {
  .site {
    max-width: 1153px;
    margin: 400px auto;
    padding: 54px 108px;
  }
}
400px
页边距负责将页眉图像向下推到页面下方。只需删除此项,即可确保页眉位于页面顶部

或者,您可以使用
margin:0 auto 400px如果希望保留底部的边距,但删除顶部的marign

请注意,您还有一个
54px
的填充。如果您希望将其刷新到页面顶部,也可以删除填充,或使用
填充:0 108px 54px仅填充底部


希望这有帮助!:)

您的
站点
-类中有空白。看起来这些样式在CSS的不同文件中是重复的(
style.CSS
和一个缓存的?
自定义CSS

更改您的CSS,它应该如预期的那样:

@media screen and (min-width: 75em) {
    .site {
        max-width: 1153px;
        margin: 0 auto; /* change to this value or remove this line, it's already inherited from style.css:967 */
        padding: 54px 108px;
    }
}

谢谢你的建议

在其他CSS中,我有

@media screen and (min-width: 75em) {
  .site {
    max-width: 1153px;
    margin: 400px auto;
    padding: 54px 108px;
  }
}
我现在把它改成了

@media screen and (min-width: 75em) {
  .site {
    max-width: 1153px;
    margin: -50px auto;
    padding: 54px 108px;
  }
}
@media screen and (min-width: 75em) {
  .site {
    max-width: 1153px;
    margin: -50px auto;
    padding: 54px 108px;
  }
}