头和菜单之间的空白

时间:2018-06-08 17:15:04

标签: html css

我有这个问题,现在我已经知道了关于html和css的基础知识,我接受了挑战来设想这个网页的外观,但是我做了一些事情并知道地址栏和菜单之间有空格,我尝试过很多东西,但我仍然没有解决问题。

非常感谢任何帮助我的人

CSS Index
body{
    overflow: hidden;
}
.main{
    position: relative;
    margin: 70px auto;
    width: 90%;
    max-width: 1080px;
    height: auto;
    z-index: 480;
}

.contenedor-destacados{
    width: 100%;
    text-align: center;
    background-color: rgba(232, 236, 237, 0.29);
    display: block;
    position: relative;
    top: 40px;
    border-radius: 10px;
}

.title-destacados{
    display: block;
    text-align: center;
    /*padding: 10px;*/
    color: rgb(50, 50, 50);
    letter-spacing: 1.3px;
    font-family: 'Droid Serif', serif;
}

CSS菜单

*{
    padding: 0;
    margin: 0;
    border: 0;
    box-sizing: border-box;

 }

 body{
     font-family: 'Roboto';
     /*background-image: url('../img/portada_index_large.jpg');*/
 }

 .material-icons .icon-menu{
     color: black;

 }

 header{
     width: 100%;
     box-sizing: border-box;
     display: block;
     height: 15px;
     position: absolute;
     background-color: rgb(3, 3, 3);
     z-index: 1000;
} 

/*.contenedor-noticia{
     position: static;
     margin-top: 0;
     display: block;
     width: 100%;
     height: 50px;
    -moz-background-size: 100% 100%; 
     background-size: 100% 100%;
     background: url(../img/portada_index1.png) no-repeat center bottom;
     overflow: hidden;
     text-align: right;
     background-color: rgb(0, 0, 0)
 }*/

 .navegacion-drawer{
     display: none;
 }

 .btn-menu{
     display: none;
 }

 .cont-logo-head{
     float: left;
     vertical-align: middle;
  }

  .logo-head{
      margin: 4px 10px;
      float: left;
  }

  .title-menu-bar{
      color: #d1d1d1;
      float: left;
      padding: 5px;
      margin-top: 7px;
      letter-spacing: 2px; 
   }

   .navegacion{
       width: 685px;
       top: 2px;
       display: block;
       position: relative;
       float: right;
       height: 56px;
       padding: 0;
       box-sizing: border-box;
       z-index: 500;
       margin-right: 3px;
    }

    .menu-general{
        list-style: none;
        position: absolute;
        z-index: 640;
        width: 100%;
        display: block;
        padding: 0;
        box-sizing: border-box;
        background: rgb(3, 3, 3);
    }

    .menu{
        float: left;
        vertical-align: middle;
        position: relative;
        display: block;
        padding: 0;
    }

    .menu:before{
        content: "";
        display: block;
        width: 0;
        height: 3px;
        background: #CBCBCB;
        transition: all .5s;
        left: 50%;
        position: absolute;
    }

enter image description here

2 个答案:

答案 0 :(得分:2)

我认为这是因为在.main你有

margin: 70px auto

我不知道您的网页,所以可能不是这样,但请尝试更改为margin: 0 auto

更新:请从top:40px

中删除.contenedor-destacados

答案 1 :(得分:0)

您需要添加top:0;

header {
    width: 100%;
    box-sizing: border-box;
    display: block;
    height: 15px;
    position: absolute;
    background-color: rgb(3, 3, 3);
    z-index: 1000;
    top: 0;
}