html - 删除边距/填充 CSS/HTML

标签 html css

<分区>

我似乎无法摆脱我整个网站上的轻微边距/填充(目前正在处理 codecademy 作业)。

我查看了整个文档,寻找我不小心添加的任何边距或填充设置,但我似乎无法在任何地方找到它。网站两侧出现空白的原因是什么?

这是我网站的 CSS 和 HTML:

/* Universal Styles */

html {
  font-family: "Roboto", sans-serif;
  font-size: 16px;
}

body {
  border-style: border-box;
}

ul {
  list-style-type: none;
}

a {
  text-decoration: none;
  color: #4A4A4A;
}

.content {
  padding: 0;
  margin: 0;
}

header .content {
  display: flex;
  margin: 0 0;
  justify-content: space-between;
  align-items: center;
  height: 85px;
}

.desktop {
}

.desktop ul {
  display: flex;
}

.desktop li a {
  margin: auto 25px;
  display: flex;
  align-items: center;
}

.desktop img {
  height: 20px;
  width: 20px;
}

.mobile {
  display: none;
}

#sign-up-section {
  background-image: url("banner-landingpage.jpg");

  color: white;
}

#sign-up-section .content.center {
  background-color: #9DC20A;
  margin-top: 170px;
  margin-bottom: 170px;
  margin-left: 100px;

}

#sign-up-section .cursive {
  font-family: Damion, curisve;
  font-weight: 50;
  font-size: 3em;
}

#sign-up-section .striking {
  color: white;
  font-size: 50px;
  font-family: 'Rubik-Regular', sans-serif;
  line-height: 1.4;
}
<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Damion" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Rubik" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,600,700" rel="stylesheet">
  <link rel="stylesheet" href="./resources/css/style.css">
  <meta charset="UTF-8">
</head>
<body>
  <!-- Header -->
  <header>
    <div class="content">
      <a href="index.html" class="desktop logo">Fotomatic</a>
      <nav class="desktop">
        <ul>
          <li><a href="#">Product detail</a></li>
          <li><a href="#">About us</a></li>
          <li><a href="https://www.instagram.com/">Follow us <img class="icon" src="./resources/images/instagram.png"></a></li>
        </ul>
      </nav>
      <nav class="mobile">
        <ul>
          <li><a href="#"><img src="./resources/images/ic-logo.svg"></a></li>
          <li><a href="#"><img src="./resources/images/ic-product-detail.svg"></a></li>
          <li><a href="#"><img src="./resources/images/ic-about-us.svg"></a></li>
          <li><a href="#" class="button">Join us</a></li>
        </ul>
      </nav>
    </div>
  </header>

  <!-- Main Content -->
  <div class="main-content">

    <!-- Sign Up Section -->
    <div id="sign-up-section" class="banner">
      <div id="sign-up-cta">
        <div class="content center">
          <div class="header">
            <h2 class="cursive">Instant</h2>
            <h1 class="striking">FORMAT CAMERA</h1>
          </div>
          <div class="email">
            <span>
              Email us to request a demo and be in our waiting list for the <strong>Febuary 2017</strong> release!
            </span>
            <div class="button">Join the waiting list</div>
          </div>
        </div>
      </div>
    </div>

    <!-- Features Section -->
    <div id="features-section">
      <div class="feature">
        <div class="center">
          <div class="image-container">
            <img src="./resources/images/feature-1.png" />
          </div>
          <div class="./resources/content">
            <h2>Advanced, automatic, instant</h2>
            <h3>Shutter speed, apperture and flash output adjust automatically</h3>
          </div>
        </div>
      </div>
      <div class="feature">
        <div class="center">
          <div class="image-container">
            <img src="./resources/images/feature-2.png" />
          </div>
          <div class="content">
            <h2>Beautifully crafted inside-out</h2>
            <h3>From the paint outside to the tiny screw inside, Fotomatic is crafted with love and 20-year of expertise</h3>
          </div>
        </div>
      </div>
    </div>

    <!-- Filters Section -->
    <div id="filters-section">
      <div class="content center">
        <h2>Over 20+ filters to choose from</h2>
        <h3>Feed your creativity with 20 different filter designed by our eclectic in-house photographers!</h3>
      </div>
      <div class="images-container">
        <div class="image-container">
          <img src="./resources/images/filter-1.png" />
        </div>
        <div class="image-container">
          <img src="./resources/images/filter-2.png" />
        </div>
        <div class="image-container">
          <img src="./resources/images/filter-3.png" />
        </div>
        <div class="image-container extra">
          <img src="./resources/images/filter-4.png" />
        </div>
      </div>
    </div>

    <!-- Quotes Section
    <div id="quotes-section">
      <div class="content center">
        <span class="quote">“It’s truly something that could create a brand new photography Renaissance”</span>
        <img class="quote-citation" src="./resources/images/photography-logo.png" />
      </div>
    </div>

    <!-- Footer -->
    <footer>
      <div class="content">
        <span class="copyright">© 2016  Fotomatic, All Rights Reserved</span>
        <span class="location">Designed in NYC</span>
      </div>
    </footer>

  </div>
</body>
</html>

最佳答案

请在 css 样式中添加以下代码,可能对您有帮助:

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

关于html - 删除边距/填充 CSS/HTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71319219/

相关文章:

html - 如何减小占用太多空间的 HTML 元素的大小-

css - ListView 和导航栏字体颜色更改 jquerymobile

css - 此代码在 ie 中不起作用(悬停以显示元素)

javascript - 侧面导航栏在切换时更改页面内容的对齐方式

javascript - 如何将FontAwesome放在select标签的值中

HTML数据提取

CSS:悬停时翻转一个 div。正面和背面内容不会隐藏在手机上

css - Rails 在哪里包含 @media css 标签?

javascript - :touch CSS pseudo-class or something similar?

javascript - 自定义选择框(jquery 脚本)- 非 FF div 滚动问题