I am in the process of creating a news blog. I have successfully designed my main article cards, each featuring an image to the left and essential content such as title, brief description, author, and date on the right side.
While everything appears flawless on a maximized browser (I'm currently using a 13-inch laptop), issues start to arise when I begin resizing the window. The image within the card fails to occupy the entire width, leaving excessive white space to its right.
Despite trying to set the image's width to 100%
, the problem persists. I am puzzled as to why this distortion is occurring exclusively with these article cards as other elements on the homepage adapt correctly even on smaller screens.
If you could spare some time to elucidate this issue and provide a solution, it would be greatly appreciated. Thank you!
Screenshots:
Larger Screens
https://i.sstatic.net/HiAL4.png
Upon resizing the browser window to a smaller size, the display distorts as shown below:
https://i.sstatic.net/c0nHB.jpg
https://i.sstatic.net/eFLMy.jpg
Lastly, for phones or smaller screens:
https://i.sstatic.net/sV4q7.png
HTML Code
<div class="card card-article">
<div class="row no-gutters right-shadow-games">
<div class="col-auto">
<img alt="" class="img-fluid" src="//placehold.it/200x200"> <a class="article-tag games" href="#">Games</a>
</div>
<div class="col">
<div class="card-block">
<div class="row">
<div class="col-md-12">
<h4 class="card-title"><a href="#">How Did van Gogh’s Turbulent Mind Depict One of the Most Complex Concepts in Physics?</a></h4>
</div>
</div>
<div class="row">
<div class="col-md-12">
<p class="card-description">Pick the yellow peach that looks like a sunset with its red, orange, and pink coat skin, peel it off with your teeth. Sink them into unripened...</p>
</div>
</div>
<div class="row">
<div class="col-md-9">
<p class="card-author"><a href="#">Author on Sep 29, 2017</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
CSS Code
.card-article {
margin-top: 2px;
margin-bottom: 5px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.card-article .card-title{
margin-top: 15px;
margin-left: 15px;
margin-right: 10px;
font-size: 18px;
}
.card-article .card-author{
margin-left: 15px;
margin-right: 10px;
color: #8d8d8d;
font-size: 12px;
line-height: 1.4;
}
.card-article .card-title a{
color: black;
font-weight: 600;
}
.card-article .card-description{
margin-left: 15px;
margin-right: 10px;
color: #8d8d8d;
font-size: 14px;
line-height: 1.4;
}
The CSS might be a bit messy, but I can certainly tidy it up a bit