img.a {
width: 200px;
height: 400px;
object-fit: cover;
}
<img class="a" src="paris.jpg" alt="Paris" width="400" height="300">
<img src="paris.jpg" alt="Paris" width="400" height="300">
css object-fit: cover属性对图片进行剪切,保留原始比例
最新推荐文章于 2023-10-25 11:39:01 发布