这是带有文本悬停的两张照片网格的代码。我想让这个网格对手机响应,而我却停留在为照片重新调整代码。 这是我的代码 HTML:如何使用CSS缩放网格图像?
<div class="plansgrid" align="center">
<div class="pic">
<img src="images/planssgrid/mcp.png" />
<div class="text">
<h1 style="font-weight: bold;">Medical Cash Plan</h1>
<p>Recrive Cashback to reduce the cost of your everyday medical expenses</p>
</div>
</div>
<div class="pic">
<img src="images/planssgrid/pcp.png" />
<div class="text">
<h1 style="font-weight: bold;">Personal Accident Plan</h1>
<p>Fracture benefits and cash lump sums from accidental injury</p>
</div>
</div>
</div>
CSS:
.pic {
display: inline-block;
position: relative;
max-width: 100%;
height: auto;
overflow: hidden;
}
.text {
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 0;
text-align: center;
background: rgba(255, 255, 255, 0.7);
transition: height 0.7s ease-out;
color: darkgreen;
}
.pic:hover > .text {
height: 150px;
}
当我在网站上录入从移动,图像不进行缩放,只croped。我想缩放此图像,以适应移动设备。 请帮我这个。 非常感谢:D!
在这里,你有这个电网的实时预览:http://hciit.atwebpages.com/