[英]My PrettyPhoto images get distorted when I save them as an .HTML File
My prettyPhoto images get distorted when I save them as an .HTML File. 将它们另存为.HTML文件时,我的prettyPhoto图像会变形。 When I save the page as .html or .htm the images become distorted, when I save the page as .php the PrettyPhoto images are fine. 当我将页面另存为.html或.htm时,图像会变形,当我将页面另存为.php时,PrettyPhoto图像就可以了。
Here's what happens.. http://Handyman-Services.NYC/NYC-Handyman-Services.php the images are fine. 这就是发生的情况。http://Handyman-Services.NYC/NYC-Handyman-Services.php图像很好。
When save as .html.. http://Handyman-Services.NYC/NYC-Handyman-Services.html the images are distorted...? 当另存为.html时。http://Handyman-Services.NYC/NYC-Handyman-Services.html图像变形了吗?
What am I missing here...please help. 我在这里想念的是什么...请帮忙。 Thanks JB 谢谢JB
Solution: Remove the height attribute from your images. 解决方案:从图像中删除高度属性。
The distortion is due to the explicitly defined width and height of the images. 失真归因于图像的明确定义的宽度和高度。 The images have CSS styling overriding the width to scale down to 100% of the parent container, but the image height is unchanged so it looks distorted (because the aspect ratio of the image is not maintained). 图像具有CSS样式,可以覆盖宽度以缩小到父容器的100%,但是图像高度没有变化,因此看起来失真(因为不保持图像的纵横比)。
The explicit width and height attributes are missing from the images in the PHP file so that is why it is not distorted. PHP文件中的图像缺少显式的width和height属性,因此这就是为什么它不会失真的原因。
you have width and height set on the tags when you save it as .html. 将其另存为.html时,您已在标签上设置了宽度和高度。 Possibly because you're using an editor of some sort. 可能是因为您正在使用某种编辑器。 Remove the width and height properties and it works fine. 删除width和height属性,它可以正常工作。
You have this in the HTML file: 您在HTML文件中有此文件:
<li class="" style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;">
<img height="666" width="1920" draggable="false" src="assets/extra-images/NY_Handyman_Services_Voted_Number_One_Handyman_Service_of_2015.jpg">
</li>
You should have this: 你应该有这个:
<li class="" style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;">
<img draggable="false" src="assets/extra-images/NY_Handyman_Services_Voted_Number_One_Handyman_Service_of_2015.png">
</li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.