Pri*_*esh 5 html css bootstrap-4
我正在制作一张具有相同图像尺寸和文字的卡片。我已经给max-height了图片。但是图像大小不相等。我将在下面给出我的代码。我附上我的网站的快照,以获取更好的参考。在这个项目中,我正在使用HTML,CSS和BOOTSTRAP4
问题是:图像
.kbcard {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 300px;
margin: auto;
text-align: center;
font-family: arial;
}
.kbtitle {
color: grey;
font-size: 18px;
}
a .kb{
text-decoration: none;
font-size: 22px;
color: black;
}Run Code Online (Sandbox Code Playgroud)
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<div class="row">
<div class="col-md-3">
<div class="kbcard">
<img src="https://www.saintleuparis.catholique.fr/IMG/arton691.jpg?1467978372" alt="John" style="max-width:300px">
<h1>John Doe</h1>
<p class="kbtitle">CEO & Founder, Example</p>
<p>Harvard University</p>
</div>
</div>
<div class="col-md-3">
<div class="kbcard">
<img src="https://www.saintleuparis.catholique.fr/local/cache-vignettes/L187xH270/images-74-b67fc.jpg?1468002198" alt="John" style="max-width:300px">
<h1>John Doe</h1>
<p class="kbtitle">CEO & Founder, Example</p>
<p>Harvard University</p>
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
我需要:按扣
小智 5
img {
vertical-align: middle;
border-style: none;
width: 100%;
height: 250px;
object-fit: cover;
}
Run Code Online (Sandbox Code Playgroud)
尝试将这些样式添加到您的图像标签