让图片最长边适应div大小,图片不变形
更新:HHH   时间:2023-1-7


.demo-upload-list {
  display: inline-block;
  width: 100px;
  height: 100px;
  text-align: center;
  line-height: 100px;
  border: 1px solid #ccc;
  border-radius: 4px;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  margin-right: 10px;
  margin-bottom: 10px;
}
.demo-upload-list .img-list {
  position: relative;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  cursor: pointer;
  float: left;
}
返回web开发教程...