The disappearance of the image is due to including the src of the image in CSS instead of HTML. The flex-direction property cannot detect the presence of the image when changing direction, resulting in the image not appearing. You can refer to my code for a correct implementation.
body {
background-color: hsl(233, 47%, 7%);
color: white;
}
h1,
p {
margin: 0;
}
h1 {
font-family: "Lexend Deca", sans-serif;
}
.desc {
font-family: "Inter", sans-serif;
font-weight: 400;
color: hsla(0, 0%, 100%, 0.75);
}
span {
color: hsl(277, 64%, 61%);
}
.wrap {
height: 98vh;
width: 98vw;
display: flex;
justify-content: center;
align-items: center;
}
.main {
display: flex;
width: 85%;
height: 80%uto;
border-radius: 10px;
background-color: hsl(244, 38%, 16%);
flex-direction: row;
}
.left {
padding: 5rem;
padding-right: 0;
display: flex;
flex-direction: column;
width: 50%;
}
.text-container .title {
margin-bottom: 2rem;
font-size: 2.5rem;
font-weight: 600;
}
.desc {
margin-bottom: 5rem;
line-height: 1.5rem;
word-spacing: 0.3rem;
font-family: "Inter", sans-serif;
}
.stats-desc {
font-family: "Inter", sans-serif;
color: hsla(0, 0%, 100%, 0.6);
}
.stats-container {
display: flex;
justify-content: space-between;
font-size: 15px;
width: 70%;
}
.right {
width: 50%;
/* background-image: url(./1.png); */
background-size: cover;
background-repeat: no-repeat;
}
.stats h1 {
font-family: "Inter", sans-serif;
}
.filter {
height: 100%;
width: 100%;
background-color: hsla(277, 88%, 32%, 0.603);
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
}
.left {
text-align: center;
}
@media (max-width: 1000px) {
.main {
/* display: block; */ /* Option 2*/
flex-direction: column-reverse;
background-color:red; /*Used for testing please remove*/
}
.left {
text-align: center;
}
/*Small modification in filer and right classes*/
.filter {
height: 100%;
width: 100%;
background-color: hsla(277, 88%, 32%, 0.603);
border-top-right-radius: 10px;
border-top-left-radius: 10px;
}
.right {
height: 50%;
width: 100%;
background-size: cover;
background-repeat: no-repeat;
}
}
<div class="wrap">
<div class="main" role="main" >
<div class="left">
<div class="text-container">
<h1 class="title">
Get <span>insights</span> that help your business grow.
</h1>
</div>
<p class="desc">
Discover the benefits of data analytics and make better decisions
regarding revenue, customer experience, and overall efficiency.
</p>
<div class="stats-container">
<div class="stats">
<h1>10k+</h1>
<p class="stats-desc">COMPANIES</p>
</div>
<div class="stats">
<h1>314</h1>
<p class="stats-desc">TEMPLATES</p>
</div>
<div class="stats">
<h1>12M+</h1>
<p class="stats-desc">QUERIES</p>
</div>
</div>
</div>
<div class="right">
<img class="filter" src= ./1.png>
</div>
</div>
</div>
The specific reason for this issue is unclear, but someone with deeper knowledge may be able to provide insight.
If you still prefer using the URL from CSS, consider replacing
flex-direction:column
with
diplay:block
Additionally, when utilizing the media query, ensure to redefine the classes used for the image and its display (.filter and .right) to apply changes effectively, as observed errors in implementation.
Furthermore, there are redundant redefinitions and incorrect use of {} brackets in the CSS.