I cannot figure out why there is a space between the blue and the red divs here:
I’ve messed around with the padding
and margin
s for a while now but nothing seems to work.
#header {
background-color: green;
}
#title {
background-color: blue;
font-size: 80px;
width: 100%;
margin: 0px 0px 0px 0px;
text-align: center;
}
#strip {
background-color: red;
font-size: 30px;
width: 40%;
margin: auto;
text-align: center;
display: flex;
}
.menu-button {
margin: auto;
text-align: center;
}
<div id="header">
<div id="title">
<p>Title</p>
</div>
<div id="strip">
<div class="menu-button">
<p>menu</p>
</div>
<div class="menu-button">
<p>menu</p>
</div>
<div class="menu-button">
<p>menu</p>
</div>
<div class="menu-button">
<p>menu</p>
</div>
</div>
</div>
` element takes the margin-bottom property from the default browser's style. If you set its margin to zero it will solve the problem.
– Adriano Mar 09 '21 at 01:32` has a default margin which causes the red `
element had its own margin property I needed to worry about.
– kevinpliang Mar 09 '21 at 01:44