首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >标题和菜单之间的空格

标题和菜单之间的空格
EN

Stack Overflow用户
提问于 2018-06-09 01:15:04
回答 2查看 42关注 0票数 0

我有这个问题,正确的现在我知道html和css的基础知识,我接受了挑战来组织这个网页的外观,但我做了一些事情,并知道它在地址栏和菜单之间有一个空间,我已经尝试了很多东西,但我仍然没有得到这个问题。

非常感谢帮助我的人

代码语言:javascript
复制
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菜单

代码语言:javascript
复制
*{
    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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-06-09 01:17:50

我想是因为你的.main里有

margin: 70px auto

我不知道您的页面,因此这可能不是它,但尝试更改为margin: 0 auto

更新:改为从.contenedor-destacados中删除top:40px

票数 2
EN

Stack Overflow用户

发布于 2018-06-09 01:29:06

您需要添加top:0;

代码语言:javascript
复制
header {
    width: 100%;
    box-sizing: border-box;
    display: block;
    height: 15px;
    position: absolute;
    background-color: rgb(3, 3, 3);
    z-index: 1000;
    top: 0;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50765559

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档