<!-- Parallax --!>
<section id="parallax-section" class="parallax">
<div class="parallax-bg">
</div>
</section>
<!-- About Me --!>
<section id="aboutme-section" class="aboutme">
<div class="row-container-flex">
<div class="about-me-column">
<div class="about-me-inner">
<div class="about-me-text">
<h2>About Me:</h2>
<p>A self-taught developer from FCC,
CodeCademy, and The Odin Project
</p>
<p class="perks">- with added perks.</p>
</div>
<div>
<a href="#" class="btn abtme-btn">Have a project for me?</a>
</div>
</div>
</section>
CSS Code:
/*PARALLAX SECTION */
.parallax-bg{
min-height: 400px;
background: url("https://abecaymo.com/wp-content/uploads/2019/02/Philippine-Flag.jpg") no-repeat center center;
background-size: cover;
background-attachment: fixed;
opacity: .4;
}
/*ABOUT ME SECTION */
.aboutme{
position: relative; <<<<<<<---- this guy
width: 80%;
height: 100%;
border-radius: 30px;
margin: -80px auto 0;
background-color: #fff;
padding-top: 20px;
}
I created a parallax background image and added opacity to it.
My problem: I tried to overlap the next section by adding (margin-top : -80px) but it also becomes transparent along with the parallax background.
THEN, I added position: relative and the background got fixed (no opacity, white background).
My question: But, WHY? What does position:relative have anything to do with it? I’m trying to understand the logic behind it.