Add Image In HTML
Table of Contents
<img src="money.jpg" alt="make money online without investment" width="600px" height="300px">
The img tag is use to add image in html document. Basically the image is not inserted directly in html document it only link the image from the directory.
Download Best Code Editor Click Here
HTML Image Attributes
In html document the <img> tag have two attributes without these you can’t link image.
- src=”” : The src attribute use to define the image path.
- alt=””: The alt attribute use to add the short description about an image.
Example Of src Attribute:
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<title>HTML IMAGE TAG</title>
<img src=”money.jpg”>
</head>
<body>
</body>
</html>
In above example I define image with the name of money.jpg. This image is place in the current project.
Alt Attribute In Image
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<title>HTML IMAGE TAG</title>
<img src=”money.jpg” alt=”make money online without investment”>
</head>
<body>
</body>
</html>
In above alt image attribute I write the short description about my image “make money online without investment “. This alt attribute will help the user in search engine to find the right content about his query.
HTML Image Size
In img tag the image size is very important. In above example I write the simple image without define size. So now we set the image size width and height with px.
Example:
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<title>HTML IMAGE TAG</title>
<img src=”money.jpg” alt=”make money online without investment” width=”1920px” height=”780px”>
</head>
<body>
</body>
</html>
HTML Add Image From Folder
Linking image from folder it is very easy and when you are working on big project you should make a separate image folder and all image place in one folder and link in different html pages.
img src=”image/money.jpg” alt=”make money online without investment” width=”600px” height=”300px”>
Pingback: HTML PARAGRAPH TAG | GSS TECHNOLOGY