开发者

According to this css code, if I resize images to 640px will that make download optimum or near optimum?

开发者 https://www.devze.com 2023-04-05 11:40 出处:网络
When placing images in posts on my blog, I want to use the urls of the images. As I understand, if I make the image at the url bigger than it will display, then this is giving the browser extra work

When placing images in posts on my blog, I want to use the urls of the images.

As I understand, if I make the image at the url bigger than it will display, then this is giving the browser extra work and it's downloading more than it needs to. So I want to make the image the optimum size.

The following code is in my theme css:

#content img {
margin: 0;
max-width: 640px;

}     #content .attachment img { max-wi开发者_运维问答dth: 900px;

The blog is at http://wordfruit.com/blog

Should I resize the image to a width of 640px?

If I resize the image, will this be the optimum size whatever browser, screen resolution, etc, that the user has?

Thanks,


The download size will always be the same: Specifying a width will only change the way the image file is displayed in the browser.

Specifying an image size different from the file's original size will give the browser more work resizing it, and there will always be a slight loss in quality (although nowadays not as much as it used to be.)

The ideal thing to do - if possible, which it isn't always - would be to serve the image at exactly the width as you specify in the CSS. That way, no resizing has to take place, but the browser knows to reserve the 640px space until the image is fully downloaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号