I am training my coding by building a generic portfolio page. So far I have a section containing a hero image with some text, then a section with some grid columns where some projects will be displayed later, and then an about section which is also a grid column with an image and some text on it. I got stuck here, because for some reason the divs in my About section are acting strange.
I can change the image values in my scss, but I cannot change the text. My About divs also float over my other content when I scale down. I tried deleting the grid columns between the Hero section and the About section to see if they were the cause of the problem, but no, the About section is still not responding to any changes I make in the scss file (except for the image) and the About div still overflow any content I put between it and the Hero section.
What is going on?
The HTML
<div class="container__main">
<div class="container__hero">
<img class="container__hero__image" src="../assets/hero-background.jpg" />
<div class="container__hero__text">
<h1>Your Digital Handyman</h1>
<p>Digital products with human insight</p>
<button class="btn">Hire me</button>
</div>
</div>
<div class="container__card">
<div class="container__card__item">
<div class="container__card__image"></div>
<div class="container__card__text">
<span class="container__card__text__upperTitle">CSS / JavaScript</span>
<h2>Train Project</h2>
<p>
A customer page I made for a fictional
Metro company to showcase the use of ES6 Javascript.
</p>
</div>
<div class="container__card__footer">
<i class="fas fa-location-arrow fa-3x"></i>
</div>
</div>
<div class="container__card__item">
<div class="container__card__image"></div>
<div class="container__card__text">
<span class="container__card__text__upperTitle">CSS / JavaScript</span>
<h2>Train Project</h2>
<p>
A customer page I made for a fictional
Metro company to showcase the use of ES6 Javascript.
</p>
</div>
<div class="container__card__footer">
<i class="fas fa-location-arrow fa-3x"></i>
</div>
</div>
<div class="container__card__item">
<div class="container__card__image"></div>
<div class="container__card__text">
<span class="container__card__text__upperTitle">CSS / JavaScript</span>
<h2>Train Project</h2>
<p>
A customer page I made for a fictional
Metro company to showcase the use of ES6 Javascript.
</p>
</div>
<div class="container__card__footer">
<i class="fas fa-location-arrow fa-3x"></i>
</div>
</div>
</div>
<div class="about__section">
<div class="about__section__hero">
<img class="about__section__hero__image" src="../assets/casual-cellphones-chatting.jpg" />
<div class="about__section__hero__text">
<p>
The psychology
<br />behind user
<br />experience
</p>
</div>
</div>
</div>
The CSS / SCSS
$primary-color: #41b883;
$secondary-color: #34495e;
$primary-text-color: black;
$secondary-text-color: white;
.container__main {
.container__hero {
position: relative;
.container__hero__image {
height: 100%;
width: 100%;
}
.container__hero__text {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
h1 {
font-size: 2.5em;
color: $secondary-text-color;
text-align: center;
}
p {
font-size: 1.4em;
color: $secondary-text-color;
text-align: center;
}
.btn {
position: absolute;
background-color: $primary-color;
left: 33%;
border: none;
color: $secondary-text-color;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
}
}
.container__card {
height: 100vh;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
align-items: center;
justify-items: center;
.container__card__item {
display: grid;
grid-template-rows: 210px 210px 80px;
grid-template-areas: "image" "text" "footer";
border-radius: 18px;
background: #fff;
box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.9);
text-align: center;
margin: 50px;
.container__card__image {
grid-area: image;
background: url("~@/assets/website1.jpg");
background-size: cover;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}
.container__card__text {
grid-area: text;
margin: 25px;
h2 {
margin-top: 5;
font-size: 28px;
}
p {
font-size: 15px;
font-weight: 300;
}
.container__card__text__upperTitle {
font-size: 15px;
color: green;
}
}
.container__card__footer {
grid-area: footer;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
background-color: $primary-color;
cursor: pointer;
.fas {
color: #fff !important;
margin-top: 15px;
}
}
}
}
.about__section {
position: relative;
height: 100vh;
display: grid;
.about__section__hero {
display: grid;
grid-auto-columns: repeat(auto-fit, minmax(19rem, 1fr));
.about__section__hero__image {
max-width: 100%;
height: auto;
.about__section__hero__text {
p {
position: absolute;
font-size: 10em;
color: $secondary-text-color;
font-weight: 800;
}
}
}
}
}
@media screen and (max-width: 759px) {
.container__hero {
.container__hero__text {
.h1 {
font-size: 1.3em;
}
.p {
font-size: 1.1em;
}
}
}
}
}