Html image


Html Image

    HTML Images

    Images are very important to beautify as well as to depict many complex concepts in simple way on your web page. This tutorial will take you through simple steps to use images in your web pages.


    Images can improve the design and the appearance of a web page.



    Contents -

    1.Insert Image

    You can insert any image in your web page by using <img> tag. Following is the simple 

    syntax to use this tag.

    <img src="Image URL" ... attributes-list/>


    The <img> tag is an empty tag, which means that, it can contain only list of attributes and it has no closing tag.

    Example

    To try following example, let's keep our HTML file test.htm and image file trulli.png in the same directory:


    <!DOCTYPE html>

    <html>

    <head>

    <title>Using Image in Webpage</title>

    </head>

    <body>

    <p>Simple Image Insert</p>

    <img src="pic_trulli.jpg" alt="Trutli>

    </body>

    </html>



    Output -

    This will produce the following result:

    Simple Image Insert




    You can use PNG, JPEG or GIF image file based on your comfort but make sureHTML list


    2.Set Image Width/Height

    You can set image width and height based on your requirement using width and height 

    attributes. You can specify width and height of the image in terms of either pixels or percentage of its actual size.

    Example

    <!DOCTYPE html>

    <html>

    <head>

    <title>Set Image Width and Height</title>

    </head>

    <body>

    <p>Setting image width and height</p>

    <img src="trulli.png" alt="Test Image" width="150" height="100"/>

    </body>

    </html>


    This will produce the following result:

    Setting image width and height


      


    READ MORE<<. HTML list


    READ MORE<<. HTML font 


    Previous.                                       Next  

    Post a Comment

    0 Comments