Wednesday, 13 July 2016

How to add images in HTML or HTML5 using Image tag

Here are the Steps to insert or Display images in html,html5 or web page using <img> tag :


Html Image Tag
1.Image tag(<img>) is used to add images in html page or website.

2.Image tag have attributes like :src, alt, width, height, align.


3.Almost all latest browser support <img> tag.


4.Put Image tags <img> </img> tag in <body> tag in your web page.

Html Image Tag
Example:
<body>
<img src="image/light.jpg" alt="No Preview"/>
</body>

5."src" attribute provide the link or path of the image either local or internet link.while the alt attribute display text of alt attribute when image path is not correct or unavailable.It will look like the below image.Html Image Tag



Html image tag


Html Image Tag

6.Earlier version of HTML are also support other <img> tag attribute like: hspace, aligh, border.
But HTML5 does not support these attributes.


Example:

<!DOCTYPE html>

<html>
    <head>
          <title>Image Tag </title>
    </head>
    <body>
<img src="http://www.like.com/images/quote.jpg" alt="No Preview" width="300px" height="300px">
    </body>
</html>
Html Image Tag
  The output of above code is:
Html image tag

1 comment:

Leave a Reply!