As a novice in the world of HTML and CSS, I am attempting to master the 1fr 1fr grid layout for my "welcome" section. My goal is to have an image on the left side and text on the right side. However, when I switch to Responsive mode in Inspect, my grid collapses either when the width drops below 1300 or the height goes under 900.
This section comes right after the header, so my dilemma is how to tackle this issue. I don't want to proceed with building the entire page only to realize later that I need numerous lines of media queries due to starting off on the wrong foot :)
I envision something similar to this: Example
Here's the code I have:
.welcome {
padding: 7em 0;
display: flex;
justify-content: center;
}
.welcome-container {
display: grid;
justify-content: center;
align-content: stretch;
grid-template-columns: 1fr 1fr;
width: 100%;
height: 100%;
background-color: white;
height: 50vh;
width: 50vw;
overflow: hidden;
}
.welcome-left {
padding: 3em;
border: 1px blue solid;
text-align: center;
}
.welcome-img {
background-image: url(../../img/tetiana-padurets-B-xb7VFtlZg-unsplash.jpg);
width: 100%;
height: 100%;
}
.img {
display: block;
}
.welcome-right {
border: 1px red solid;
padding: 5em 3em;
}
.welcome-title {
text-align: center;
color: #3f3f3f;
font-weight: 400;
margin-top: 1em;
}
<section class="welcome">
<div class="welcome-container">
<div class="welcome-left">
<div class="welcome-img"></div>
</div>
<div class="welcome-right">
<h2 class="welcome-title"><span>Lorem Ipsum!</h2></span>
<p class="welcome-desc">Lorem ipsum dolor sit amet consectetur, adipisicing elit. Sint dolor voluptas quo id maiores distinctio quidem, voluptatum voluptates dolorem eum eius vitae. Doloremque maiores, inventore vel error perferendis necessitatibus quae debitis cumque ipsa explicabo facere soluta vero asperiores, voluptates reprehenderit labore accusantium dolores.
</p>
</div>
</div>
</section>
Cheers!