答案 0 :(得分:4)
检查以下代码段
.c {
padding: 15px;
margin-top: 30px;
box-shadow: 0 0 16px 1px rgba(0, 0, 0, 0.1);
}
.c img {
width: 100%;
object-fit: cover;
border-radius: 3px;
/* background-color: white; */
box-shadow: 0 3px 20px 11px rgba(0, 0, 0, 0.09);
}
.c .top-sec {
margin-top: -30px;
margin-bottom: 15px;
}

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<!--
Bootstrap docs: https://getbootstrap.com/docs
-->
<div class="container">
<div class="row">
<div class="col-4">
<div class="card c">
<div class="top-sec">
<img src="http://via.placeholder.com/350x150">
</div>
<div class="bottom-sec">
<p> Some data here</p>
<p> Some data here</p>
<p> Some data here</p>
<p> Some data here</p>
</div>
</div>
</div>
<div class="col-8">
</div>
</div>
</div>
&#13;
答案 1 :(得分:-1)
检查此页面并使用以下html而不是示例中给出的html https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_cards2
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
width: 40%;
border-radius: 5px;
margin-top: 50px;
}
.card:hover {
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
img {
border-radius: 5px 5px 0 0;
width: 80%;
margin: 0 auto;
position: relative;
left: 50%;
transform: translate(-50%);
top: -50px;
}
.container {
padding: 2px 16px;
}
</style>
</head>
<body>
<h2></h2>
<div class="card">
<img src="img_avatar2.png" alt="Avatar">
<div class="container">
<h4><b>Jane Doe</b></h4>
<p>Interior Designer</p>
</div>
</div>
</body>
</html>