让图片最长边适应div大小,图片不变形

发布时间:2020-08-04 00:12:17 作者:1枚小菜鸟
来源:网络 阅读:1276

让图片最长边适应div大小,图片不变形

.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;
}
推荐阅读:
  1. 在css上让图片居中、图片适应的方法是什么
  2. bootstrap如何让图片自适应

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

图片 自适应 %d

上一篇:linux动态链接

下一篇:Firebug无法添加到最新版firefox55.0.*中解决办法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》