How to change the size of an image HTML? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to change the size of an image HTML?

I have a picture that i want to put and its really big how can i changs it's size

29th Apr 2019, 6:37 PM
ืจื•ืขื™ ืžืœื›ื ื•
5 Answers
+ 5
In HTML, the <img> tag has two main attributes for this: width height All you need to do is to add the following: <img src="my_image.jpg" alt="my image" height="127" width="127"> The above code will resize the image to 127x127px. Hope it helps ๐Ÿ˜ƒ
29th Apr 2019, 6:41 PM
Edwin Pratt
Edwin Pratt - avatar
+ 5
It is a pleasure ๐Ÿ™‚
29th Apr 2019, 6:43 PM
Edwin Pratt
Edwin Pratt - avatar
+ 3
hi ืจื•ืขื™ ืžืœื›ื ื• if you have a really big image and you include this original image in your website, note this tip: Downsizing a large image with the height and width attributes forces a user to download the large image (even if it looks small on the page). To avoid this, rescale the image with a program before using it on a page. this is better for the performance of the website ๐Ÿ™‚ https://www.w3schools.com/tags/att_img_width.asp
29th Apr 2019, 7:56 PM
asa22
0
Thank You!
29th Apr 2019, 6:42 PM
ืจื•ืขื™ ืžืœื›ื ื•
0
if you use an id element OR class element you can customize it through the css code, for example: <img src =โ€œ#โ€ id =โ€œimageSizeSmallโ€> therefore the css code would be: .imageSizeSmall{ (( insert customization here )) } This proves to be more useful since you can reuse it other than have inline styling to customize all the pictures/images in your website.
1st May 2019, 9:06 AM
Zhafira Elham
Zhafira Elham - avatar