How to add image or use <img> | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

How to add image or use <img>

15th Dec 2016, 4:11 AM
harish jaybhaye
harish jaybhaye - avatar
2 ответов
+ 2
<img src="path of the image file image.jpg"></img>
15th Dec 2016, 4:20 AM
Anand Choudhary
Anand Choudhary - avatar
0
1) Use the HTML <img> element to define an image. 2) Use the HTML src attribute to define the URL of the image. 3) Use the HTML alt attribute to define an alternate text for an image, if it cannot be displayed. 4) Use the HTML width and height attributes to define the size of the image. HTML Images Syntax <img src="url" alt="some_text" style="width:width;height:height;"> The alt Attribute The alt attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader). If a browser cannot find an image, it will display the value of the alt attribute: Example <img src="wrongname.gif" alt="HTML5 Icon" style="width:128px;height:128px;"> Image Size - Width and Height You can use the style attribute to specify the width and height of an image. The values are specified in pixels (use px after the value): Example <img src="html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;"> Images in Another Folder If not specified, the browser expects to find the image in the same folder as the web page. However, it is common to store images in a sub-folder. You must then include the folder name in the src attribute: Example <img src="/images/html5.gif" alt="HTML5 Icon" style="width:128px;height:128px;"> Images on Another Server Some web sites store their images on image servers. Actually, you can access images from any web address in the world: Example <img src="http://www.sololearn.com/images/wsolo_green.jpg" alt="solo.com">
15th Dec 2016, 4:29 AM
Akwin Lopez
Akwin Lopez - avatar