html - 元素之间不需要的边距 - 无法删除

标签 html css margin

在我无法解释的“DIV: IMAGE”和“DIV: SLIDER”之间有一个很大的“空白”。我看不到我在两个元素之间编码了一个边距,无论我对样式表做了什么,我都无法删除它。
代码的哪一部分导致了这个?有哪些干净的解决方案?非常感谢。

.wrap {
  margin: 0px auto;
  width: 80%;
  margin-top: 10px;
  padding: 3em 0em;
  position: relative;
  color: #FFF;
}
.image {
  background-image: url("http://www.thestrandnyc.com/d/main/media/Destination/__thumbs_1200_700_crop/NY_City.jpg");
  background-size: 110% 100%;
  padding: 0px 0px 210px 0px;
  border: 1px solid red;
}
.slider {
  padding: 2em 0em;
  background-color: #F4F4F4;
  position: relative;
  height: 200px;
  margin: 0px auto;
  border: 1px solid red;
}
.slider p:first-child {
  color: #fff;
  background: #35AFBA;
  font-size: 2.8em;
  font-weight: 900;
  border-radius: 100%;
  width: 200px;
  height: 200px;
  display: inline-block;
  vertical-align: middle;
  text-align: center;
  line-height: 200px;
  margin: 0em 0em 0em 1.2em;
  position: absolute;
}
.slider p:nth-child(2) {
  color: #ff605f;
  text-shadow: 0px 0px 2px #ff605f;
  background: rgba(230, 231, 231, 0.56);
  font-size: 2.8em;
  font-weight: 900;
  border-radius: 100%;
  width: 200px;
  height: 200px;
  display: inline-block;
  text-align: center;
  line-height: 200px;
  margin: 0em 0em 0em 4.5em;
  position: absolute;
}
<body>

  <div class="image">
    <div class="wrap">
      <div class="nav">

        <h1>Resume</h1>
        <ul>
          <li>Home</li>
          <li>Portfolio</li>
          <li>Skills</li>
          <li>Experience</li>
          <li>Contact</li>
        </ul>

      </div>

      <div class="me">
        <h2>Andrew Hardiman</h2>
        <p>Webdesigner & Developer</p>
        <p>Read More</p>
      </div>

    </div>
  </div>

  <div class="wrap">
    <div class="slider">

      <p>HTML</P>
      <p>css</P>
      <h3>I design and develop amazing websites that are sleek, easy-to-navigate and exiting to use.</h3>
      <p>Work with us to plan your digital marketing mix and achieve better results online.</p>
    </div>
  </div>

最佳答案

div.sliderdiv.wrap 里面,它有一个 margin-top 和一个 padding。它们造成了间隙,移除它们将解决这个问题。

关于html - 元素之间不需要的边距 - 无法删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30921508/

相关文章:

javascript - 如何在 jQuery 中引用按钮?

javascript - 在 HTML 选择选项中保留空白

css - Ionic applicaiton set css translate3d not run in my device

html - 为什么在我使用边距时 IE 会创建一个空白区域?

css - 边距/填充不起作用

html - 我如何让图片的高度为 100%

html - 如何使多行链接之间的空间可点击

html - 嵌套的 flex 元素不会使父级增长

CSS 布局问题、 float 、嵌套 div

ios - Xcode 9.1 警告 "Language directional layout margins before iOS 11.0"