Jump to content

Image is already scaled - height/width redundant?


Intrepid

Recommended Posts

According to W3schools, it is helpful to use the height/width attribute because:

 

"the browser does not know the size of the image, and cannot reserve the appropriate space to it."

 

 

But, if i already scaled the image to the right pixel size that I want, shouldnt the browser then pre-load

the image already in the correct size, which is by pixel size (since what other way should it load)

 

This is what you want to do anyway because it takes up less bandwidth,

So, if the image is already scaled to the right size, this then would render the height/width attribute redundant, or am I missing something here?

 

thanks

Link to comment
Share on other sites

The difference is difficult to see unless you are on a low-bandwidth connection. When dimensions are given the webpage will be displayed with properly sized empty areas where the images will be loaded. When dimensions are not given the webpage is collapsed where the images are missing and will expand as the image are loaded and the sizes are determined.

Link to comment
Share on other sites

The difference is difficult to see unless you are on a low-bandwidth connection. When dimensions are given the webpage will be displayed with properly sized empty areas where the images will be loaded. When dimensions are not given the webpage is collapsed where the images are missing and will expand as the image are loaded and the sizes are determined.

 

Oh i see, so the dimensions are really not for the image itself, but for everything else in the webpage, so as to keep the structure of the page before it loads.

 

And it is only the added bonus of the image being able to scale using this feature as well.

This is what i was missing, and couldnt figure it out because my connection is not slow enough.

 

thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...