如何从图库中制作图像大小相同? (如果最初他们有不同的尺寸)。
在此处添加图像说明<div class="img">
<a target="_blank" href="https://unsplash.it/g/300/400">
<img src="https://unsplash.it/g/200/300" alt="Forest" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600"height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
</div>
<div class="img">
<a target="_blank" href="https://unsplash.it/g/400/400">
<img src="https://unsplash.it/g/400/400" alt="Northern Lights" width="600" height="400">
</a>
<div class="desc">Add a description of the image here</div>
答案 0 :(得分:1)
更新Css 在Css中添加https://www.example.com/test.php
类。并移除img
类
height :auto
注意:您可以改变Hight&amp;宽度在Css
div.img img
查看实时演示 Here
下面的代码段示例
img
{
width:300px;
height:200px;
}
div.img img
{
width: 100%;
}
div.img {
margin: 5px;
border: 1px solid #ccc;
float: left;
width: 180px;
}
div.img:hover {
border: 1px solid #777;
}
div.img img {
width: 100%;
}
div.desc {
padding: 15px;
text-align: center;
}
img
{
width:300px;
height:200px;
}
答案 1 :(得分:0)
这取决于您希望如何调整大小不同的那些。换句话说,如果您有300x200图像和300x300图像,则可以:
这些都是你拥有的所有选项,并且它们的实现方式略有不同,所以首先找出你想要的方式。