lcosima

1.放大预览图片不失真css设置

width: auto;height: auto;max-width: 100%;max-height: 100%;

2.100%宽度显示图片,高度自动不失真

<!--

我们将img css样式宽度设置为100%
height为自动。 将overflow设置为hidden;

imgbox不要给高度,设置为overflow:auto。图像就不再失真

请根据页面合理使用。。
-->
<style>

.imgbox{overflow:auto;}
.imgbox img{width:100%; height:auto;overflow: hidden;}

</style>

<div id = "imgbox">
          <img src="./img/product.png">
    </div>

 

 

分类:

技术点:

相关文章:

  • 2021-10-12
  • 2019-10-18
  • 2021-09-29
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
猜你喜欢
  • 2021-11-06
  • 2022-12-23
  • 2021-05-22
  • 2021-11-03
  • 2021-10-12
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案