How do you write working of add image in HTML?


  I thing we know what is HTML? Yes, HTML is used for web designing . In  this page you can able to see how to add image in HTML page or web page.  At the first step we have to know about image tag. The image tag is<img > inside this tag we have to add to main things. They are

1. src - It is used to select or mention the image location. If the image in another web page we can able to access using the image link. The image link should be inside the src tag. Eg: src="img1.png".

2. alt - It is used to display a text in web page when the image is not fount in server or certain url. The display text should should be placed inside the alt tag. Eg: alt="myphoto"

  Then we are going to write a simple code to display a image in web page.

<html>

    <head>

        <title>Add image in html</title>

    </head>

    <body>

        <img src="img.png" alt="myphoto">

    </body>

</html>

 We can also add the size of the image in the img tag it self.

<html>
    <head>
        <title>Add image in html</title>
    </head>
    <body>
        <img src="img.png" alt="myphoto" style="width:450px;height:500px";>
    </body>
</html>

We can also able to do this with the height and width without the style tag .The sample program given below.
<html>
    <head>
        <title>Add image in html</title>
    </head>
    <body>
        <img src="img.png" alt="myphoto" width="500" height="600">
    </body>
</html>

0 تعليقات

إرسال تعليق

Post a Comment (0)

أحدث أقدم