【发布时间】:2021-10-13 23:48:10
【问题描述】:
我有大尺寸的图像。我正在尝试将其缩小到个人资料图片。但是我无法保持原始图像的相同质量?除了裁剪图像,还有什么更好的选择?
.img-wrapper {
width: 50px;
height: 50px;
border-radius: 50%;
}
img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 50%;
}
h2 {
font-family: arial;
}
<h2>Making image small without losing quality</h2>
<div class="img-wrapper">
<img src="https://images.unsplash.com/photo-1592234789031-94bf65f630ed?ixid=MnwxMjA3fDB8MHxzZWFyY2h8Mnx8bWFuJTIwc21pbGV8ZW58MHx8MHx8&ixlib=rb-1.2.1&w=1000&q=80" alt=""/>
</div>
【问题讨论】:
-
为了响应性,最好使用
picture元素developer.mozilla.org/en-US/docs/Web/HTML/Element/picture,它可以让您使用不同尺寸的不同图像,从而优化尺寸和质量
标签: html css image responsive