在html文档中,使用高度和宽度标签调整图像大小是不好的做法吗? [英] In an html document, is it a bad practice to resize images with the height and width tags?

查看:105
本文介绍了在html文档中,使用高度和宽度标签调整图像大小是不好的做法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个徽标图像,并且我想在另一个页面上使用它,并且要求它的尺寸较小,则我的直觉就是创建一个新图像,并用图形编辑器调整大小。然而,我听说如果我改用原始图片并通过改变图片标签中的高度和宽度来调整图片大小,那么对用户更好。



<所以我问人群,这里最好的做法是什么?



感谢您的时间,



- 亨利

解决方案

我的默认响应是在图形应用程序中调整大小,但这取决于重新使用它。



当您将图片大小调整为浏览器时,必须先下载原始(全尺寸)图片,然后浏览器才能以较小比例显示。这意味着您使用更多的带宽,并且您的网页需要更长时间才能加载。不过,如果您主要在整个网站中使用较大的图片,那么始终使用此图片会更快,因为浏览器可以缓存它。



如果您关注图像质量,你会得到更好的结果,并且可以通过使用专门的图形应用程序调整图像大小来控制下采样过程。


If I have a logo image, and I want to use it on another page where I require it to be a smaller size, it is my instinct to create a new image, resized with a graphics editor. However, I am hearing that it is better for the user if I instead refer to the original image and resize it with the browser by changing the height and width in the image tag.

So I ask the crowd, what is the best practice here?

Thank you for your time,

-- Henry

解决方案

My default response would be "Resize it in a graphics application", but it depends on how you're using it.

When you leave image resizing to the browser, the original (full-size) image has to be downloaded before the browser can display it at a smaller scale. This means that you use more bandwidth and your webpage takes longer to load. However, if you mainly use the larger image throughout your site, then it will be faster to always use this image, since the browser can cache it.

If you're concerned about image quality, you would get better results and would have more control over the downsampling process using a dedicated graphics application to resize the image.

这篇关于在html文档中,使用高度和宽度标签调整图像大小是不好的做法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆