【问题标题】:Can't get my div to reach the top and sides of my page无法让我的 div 到达页面的顶部和侧面
【发布时间】:2019-04-07 06:33:29
【问题描述】:

我无法让我的 div 覆盖页面的顶部和侧面。有一个奇怪的差距。此 div 位于 body 标记内。我为 body 和 div 添加了边距和填充为零。它不会消失。

<style scoped>
body {
  padding: 0; margin: 0;
}

#navdiv {
    width: 100%;
    text-align: center;
    height: 5rem;
    background-color: white;
    padding: 0;
    margin: 0;
    display: inline-block;
    font-family: 'Lato', sans-serif;
}


a {
    text-decoration: none;
    color:rgb(31, 32, 32);
    border-bottom: 0.05rem dotted black;
    padding: 1.0rem;

}

a:hover {
  background-color: rgb(88, 88, 88);
  transition: all 0.8s ease;
  color: white;
}


</style>

<template>
  <div id="navdiv">
    <nav id="nav1" @mouseover="mouseOver">
      <div v-show="active">show</div>
      <router-link v-for="routes in links" 
      v-bind:key="routes.id"
      :to="`${routes.page}`">{{routes.text}}</router-link>
    </nav>
  </div>
</template>

【问题讨论】:

  • 请在此处添加您的代码。不仅仅是屏幕截图。
  • @ManojKumar 添加在上面
  • 请添加该部分的html代码。
  • 添加在底部!
  • 您的代码未显示您所描述的问题。检查div的所有父div的宽度和位置。

标签: javascript html css margin padding


【解决方案1】:

你试过margin: 0; padding:0 像这样:

template, div {
    padding: 0;
    margin: 0;
}

【讨论】:

  • “HTML 内容模板 (
猜你喜欢
  • 1970-01-01
  • 2014-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多