html tag for images

 
Html tag for images is used to insert an image in a website.
 
Image path that declare using inside tag
 
If you are using empty tag there is no closing tag or called an unpaired tag.
 
Html is a building of a website so the tag is already specified so we can't create our own for us. Like that tag also have some attributes are used to display an image on a website or webpage. 
 
The attributes are src, src stands for "source", which is used to fetch an image from URL.
And another one is alt Attribute used to define an "alternate text" for an image .some time the server can't get an error that time alt is shown alternate text in img source. 
 
 
Another part can resize the image using width and height to display an image on a webpage.
 

HTML Tags for images - Details Attributes 

 



Attributes values Description
width "width: size_px" display the image using specific width size
Height "Height: size_px" display the image using specific Height size
Align "left"-"right" which size the image will appear using align side
src "source url of the image path" required specific image path should be absolute.
border "border:size" Image border size eg: 0 or 1px solid black;
alt "alternate text" Required text to be identify the image because some reason.
the image can't be displayed .


<img src="source url" alt="alt text">



Html Image Tag



<html>
<head>
</head>
<body>
<img src="images/img_nat.png" width="120" height="70" alt="natural" />
</body>
</html>

HTML tag for Images

Image alignment -right side



<html>
<head>
<style>
.container{width:960px;margin:70px;}
</style>
</head>
<body>
<div class="container">
<img src="img1.jpg" width="300" height="300" alt="Natural" align="right" style="background-position:cover; margin-left:20px;"/>
<p style="font-size:24px;font-weight:600;line-height:1.5;text-align:justify; margin-left:120px;">"Html is a building of a website so the tag is already specified so we can't create our own for us. Like that <img /> tag also have some attributes are used to display an image on a website or webpage.
Html is a building of a website so the tag is already specified so we can't create our own for us. Like that <img /> tag also have some attributes are used to display an image on a website or webpage.
</p>
</div>
</body>
</html>
  

output:


HTML tag for Images

Image alignment -left side



<html>
<head>
<style>
.container{width:960px;margin:70px;}
</style>
</head>
<body>
<div class="container">
  <img src="img1.jpg" width="300" height="300" alt="Natural" align="left" style="background-position:cover; margin-right:20px;"/>
  <p style="font-size:24px;font-weight:600;line-height:1.5;text-align:justify; margin-left:120px;">"Html is a building of a website so the tag is already specified so we can't create our own for us. Like that <img /> tag also have some attributes are used to display an image on a website or webpage.
Html is a building of a website so the tag is already specified so we can't create our own for us. Like that <img /> tag also have some attributes are used to display an image on a website or webpage.
</p>
</div>
</body>
</html>  
  

output:


HTML tag for Images

Using Anchor tag for image link



<html>
<head>
</head>
<body>
  <a href="https://dailyaspirants.com"> 
  <img src="img1.jpg" width="300" height="300" alt="Natural" />
  </a>
</body>
</html>

Output:


HTML tag for Images

I hope you will learn something in html tag for images . Thankyou for visiting our website.
Previous Post Next Post