Page 1 of 1

What's the better?

Posted: Tue Mar 15, 2016 2:39 am
by conectart
sorry for my english, but I come from Spain.

I would like to know which of these options is better and more effcient:

Code: Select all

 <img src="aaa.jpg" widht="50">

Code: Select all

<img src="aaa.jpg" clas="reducir">
The reason is that I have more than 200 images, and I would like that to be reduced KBs

Un saludo,

Re: What's the better?

Posted: Tue Mar 15, 2016 7:52 am
by Albert Wiersch

If you want to reduce the size of the image file to reduce the number of KBs (bytes) that are transferred then you will need to reduce the image size of aaa.jpg using an image processing program. Unfortunately, neither one of those options you mentioned would do that.

Re: What's the better?

Posted: Thu Apr 28, 2016 3:09 pm
by RSteinwand
You always want to specify the width and height of an image to get it to display faster.

Assuming you use html5, you could remove quotes from your some of html.

Code: Select all

<img src="aaa.jpg" width=50 height=100 alt="a picture of aaa">
Some of the quotes have to remain if you have spaces in them. I prefer to leave the quotes for href and src just to be safe.

Check out the <picture> element if you want to use smaller images.