I have the following code:
@import url('https://fonts.googleapis.com/css?family=Merriweather|Open+Sans');
.blogmaster {
display: flex;
margin: 60px;
margin-top: 0;
margin-bottom: 0;
}
.blogmaster div {
width: 100%;
max-width: 500px;
}
@media all and (max-width: 500px) {
.blogmaster {
flex-flow: wrap;
margin: 20px;
margin-top: 0;
margin-bottom: 0;
}
}
.container1 {
display: flex;
padding: 20px;
justify-content: center;
overflow: hidden;
}
.square:hover {
-webkit-transform: translate(20px, -10px);
-ms-transform: translate(10px, -10px);
transform: translate(10px, -10px);
-webkit-box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}
.square {
position: relative;
height: 100% !important;
padding:3px;
background: white;
border-radius: 4px;
box-shadow: 0px 5px 20px #D9DBDF;
-webkit-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
}
.mask {
clip: rect(0px, 450px, 220px, 0px);
border: 5px solid #555;
border-radius: 4px;
position: absolute;
width:100%;
height: 100%;
top:0;
left:0;
z-index:1;
}
@media screen and (max-width: 480px) {
.mask{
width: 100% !important;
}
}
.h11 {
margin: auto;
text-align: left;
margin-top: 240px;
padding-left: 30px;
padding-right: 30px;
font-family: 'Merriweather', serif;
font-size: 24px;
}
p9 {
text-align: justify;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
color: #C8C8C8;
line-height: 18px;
padding-left: 30px;
padding-right: 30px;
display: block;
}
.button56 {
background-color: #3EDD84;
color: white;
width: 100px;
padding: 10px 18px;
border-radius: 3px;
text-align: center;
text-decoration: none;
display: block;
margin: 15px 70px 13px 30px;
font-size: 12px;
cursor: pointer;
font-family: 'merriweather';
}
.parent-div {
display: flex;
flex-wrap: nowrap;
justify-content: center;
}
@media screen and (max-width: 480px) {
.parent-div {
flex-direction: column;
}
}
<section>
<div class="section-title">
<h2>Featured Blogs Of The Day</h2>
</div>
<div class="parent-div">
<div class="child-div">
<div class="blogmaster">
<div class="column1">
<div class="row1">
<div class="container1">
<div class="square">
<img src="https://images.unsplash.com/photo-1504610926078-a1611febcad3?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=e1c8fe0c9197d66232511525bfd1cc82&auto=format&fit=crop&w=1100&q=80" class="mask" style="border: 5px solid #555">
<div class="h11">“Chances Of My Uni/College Admission?”</div>
<p9>It is that time of the year again (yay!đ) where we — high school students — are supposed to fill out the applications and land in our dream Universities/Colleges!</p9>
<div><a href="https://m-hussainomer03.medium.com/chances-of-my-uni-college-admission-20bc0efec0af" target="_" class="button56">Read More</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- new start of blog -->
<div class="parent-div">
<div class="child-div">
<div class="blogmaster">
<div class="column1">
<div class="row1">
<div class="container1">
<div class="square">
<img src="https://www.isfasports.gr/image/cache/data/products/pr_3-1100x1100.jpg" class="mask" style="border: 5px solid #555">
<div class="h11">My Career Advice To You: Take These Steps...</div>
<p9>Humans tend to make mistakes — and its completely normal as it results in the growth and development of an individual — either psychologically or physically.</p9>
<div><a href="https://m-hussainomer03.medium.com/my-career-advice-to-you-take-these-steps-to-ultimate-prosperity-6c0687ce9c9f" target="_" class="button56">Read More</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- End blogs Section -->So I have the above code embedded in my website, and so when I view my website on a smaller screen, my output looks like this:
The width of the image is not fitted to the whole card. By "fitted" I mean just the width and not the height. Like, in other words, I just want the width of the image to stretch. That is all. The height of the image is fine.
Expected Outputs
On Larger Screen:
This part is already working for me, but I am just showing you in case. When giving suggestions, Please do not modify this part of the code that is working for larger screens. The output of the code I sent above is exactly what I am looking for on larger screens
On smaller Screens:
So on smaller screens, I just would like the image to stretch a bit more to the end of the card. That is it. The height and everything else is fine. Any suggestions on how I can accomplish this and making the width of the image stretch out to the card?



Aucun commentaire:
Enregistrer un commentaire