How can I remove the white spaces on the right and left side of a section when applying a background-color?
https://i.sstatic.net/WbVuv.png
I want the background-color to fill out the entire width of the section. Should I use extra padding to solve this issue?
I have checked the CSS for parent elements but couldn't find anything that could be causing the problem. Below is the CSS and HTML code. I suspect the error lies within the CSS.
HTML:
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="css/style.css">
<header id="header">
<img id="header-img" src="https://cdn.freecodecamp.org/testable-projects-fcc/images/product-landing-page-logo.png" alt="Logo">
<nav id="navbar">
<ul id="nav-list">
<li><a class="nav-link" href="#newsletter">Newsletter</a></li>
<li><a class="nav-link" href="#video">Video</a></li>
<li><a class="nav-link" href="#privacy">Privacy</a></li>
</ul>
</nav>
</header>
<body>
<section id="newsletter">
<form id="form" action="https://www.freecodecamp.com/email-submit" method="post">
<label for="email">Subscribe to our newsletter!</label>
<br>
<input type="email" id="email" placeholder="Your E-Mail" required>
<br>
<input type="submit" id="mail-news-submit" value="Subscribe!">
</form>
</section>
</body>
</html>
CSS:
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap');
/* Debugger for unwanted CSS properties. Source: https://blog.wernull.com/2013/04/debug-ghost-css-elements-causing-unwanted-scrolling/
* {
background: #000 !important;
color: #0f0 !important;
outline: solid #f00 1px !important;
}
*/
:root {
--smoky-black: #191516ff;
--green-sheen: #72bda3ff;
--apricot: #ffcab1ff;
--brick-red: #ce4257ff;
--little-boy-blue: #72a1e5ff;
font-family: 'Roboto', sans-serif;
}
#header {
display: flex;
justify-content: space-between;
align-items: center;
position: fixed;
background-color:white;
width: 100vw;
height: 2.5vw;
top: 0;
left: 0;
}
#nav-list {
padding-right: 1vw;
}
a {
text-decoration: none;
color: black;
}
a:hover {
color: grey;
}
#nav-list li {
list-style: none;
display: inline-block;
}
#header-img {
width: 20vw;
}
#newsletter {
text-align: center;
padding-top: 3vw;
background-color: var(--apricot);
margin: 0;
}
#email, #mail-news-submit {
margin-top: 0.3vw;
margin-bottom: 0.3vw;
}
#mail-news-submit {
color: white;
background-color: var(--smoky-black);
padding: 0.5em 1em;
border-radius: 10em;
border: none;
}