How to resize images using HTML?
SolvedHello,
I'm currently creating a photo library on a website and I would like all the photos I display to be reduced by 50%, for example.
How can I do this?
I tried this:
<img src="blabla.jpg" height="50%" width="50%">
but the image then becomes 50% of the height and width of the page!
Should I use CSS properties?
2 answers
-
<img src="ton_image.JPG" height="352" width="470" >
I posted this link and it works perfectly, so I don't see what the problem is... sorry.-
ModeratorAnd your values 352 and 470, where did you get them from? From the image?
So you had to read the image, then generate the corresponding HTML code.
He wanted the HTML code to automatically display images at 50% of their original size, which is not possible with HTML alone: it is absolutely necessary to read the dimensions of the image in order to put the correct values in width and height. -
Hello,
@ ouafff9: I confirm that it works, I just used it.
Regarding cedont you're talking about "gro", I assume you want all your images to appear at the same size? Reducing them by 50% each means they need to be the same size to begin with, so far we agree?
So: Place your tag <img src="your_image.JPG" height="x" width="x" >
and replace the "x" with a value that suits you, and that will hence be universal to all your images!
And if your images are not the same size to begin with, you’ll have to do it manually! (That is to say, you study the size of each image and find its optimal reduced size)
Yes, it’s annoying to make something nice! =P
Good luck ;)
Gloubi. -
-
-
-