I've got a background image in a parent container that covers the full screen width.
I want a child container centered within the parent which will contain some text and have a semi-transparent background color.
No matter how I try to set the top margin of the child, the parent container's top margin moves along with the child's as if the two top edges are "glued" together. The parent's margin follows the child's.
How can I make the contained element (.content) move down while keeping the top edge of the image fixed to the top of the page?
Thanks!
BG image follows box's top margin
/* Header */
.hero {
background: url('../images/hero_laptop_2.jpg') no-repeat center center/cover;
height: 75vh;
position: relative;
color: #fff;
}
.hero .content {
border: solid black 1px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
width: 40%;
height: 60%;
padding: 20px;
z-index: 1;
margin-left: auto;
margin-right: auto;
margin-top: 200px;
}
<header class="hero">
<div id="navbar" class="navbar top">
<h1 class="logo">
<span class="text-primary"><i class="fas fa-desktop"></i> IT</span>-Simplified</h1>
<h1 id="navbar-phone">845-520-1115</h1>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="services.html">Services</a></li>
<li><a href="testimonials.html">Testimonials</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="#contact-form">Contact</a></li>
</ul>
</nav>
</div>
<div class="content">
<h1>Welcome to IT-Simplified</h1>
<p>We Provide COMPUTER SOLUTIONS... <br>Simply & Affordably.</p>
<p id="call-us">Call Us: 845-520-1115</p>
<!-- <a href="testimonials.html" class="btn"><i class="fas fa-chevron-right"></i> Testimonials</a> -->
</div>
</header>
