简体   繁体   English

在Weebly中保持产品图像尺寸和长宽比

[英]Maintaining product image size and aspect ratio in Weebly

I am using Weebly to design an eCommerce site. 我正在使用Weebly设计电子商务网站。 I am having issues with the product element images, The images appear to twice the size from original upload, i do not have access to any other images as the client provided these for me. 我的产品元素图片有问题,图片显示的大小是原始上传图片的两倍,由于客户为我提供了这些图片,因此我无法访问任何其他图片。

I cant seem to get the images to retain the "Natural" size. 我似乎无法获得保留“自然”大小的图像。

I have tried changing what I think is the relevant CSS; 我尝试过更改我认为相关的CSS; and added the following; 并添加了以下内容;

div.wsite-com-product-images-main-image,.wsite-com-product-images-main image{width: 100% !important;Height: 100% !important;}

and

.mousetrap{display:none;}

Neither appear to be working, it might be a .js query thats running a calculation in order to resize the images but i can find the relevant code. 似乎都没有工作,可能是一个.js查询,该查询正在运行计算以调整图像大小,但是我可以找到相关代码。

website is https://www.exoticcarving.com/ 网站是https://www.exoticcarving.com/

example page: https://www.exoticcarving.com/store/p117/Wooden_Bear_%28log%29%2C_handmade_from_suar_wood.html 示例页面: https//www.exoticcarving.com/store/p117/Wooden_Bear_%28log%29%2C_handmade_from_suar_wood.html

Would really appreciate some help with this please 非常感谢您的帮助

Did you want something like this? 你想要这样的东西吗?

 .small img { width: 200px; height: 400px; object-fit: contain; } .img-small { width: 200px; height: auto; } 
 <div class="small"> <img src="https://www.w3schools.com/css/paris.jpg" /> </div> <img src="https://www.w3schools.com/css/paris.jpg" class="img-small" /> <img src="https://via.placeholder.com/1000x1000" class="img-small" /> <img src="https://via.placeholder.com/4000x3000" class="img-small" /> 

Setting a width and having the height property set to auto will scale the image properly. 设置宽度并将height属性设置为auto将正确缩放图像。 On the other hand, here's a reference to object-fit :) 另一方面,这是对object-fit的引用:)

Also, here's a working example . 另外,这是一个有效的示例 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM