HTML Images



The HTML <img> tag is used to embed images in a web Documents.

images are visual appearance of the web documents.

Image tag have a specific Attribute which called src

The src attribute declare the path of the image.

HTML img tag Syntax

<img src="example.jpg" alt="example image">

Example

<!DOCTYPE html>
    <html>
    <head>
        <title>Example of HTML img tag</title>
    </head>
    <body>
        <div>
       <img src="/img/example.png" alt="html">	
        </div>
    </body>
    </html> 
    


Click on the "Run This Code" button to see how it works.


HTML image Height and Width

Image height and width based on requirments.we can add height and width of the image in terms of pixels or percentage.

<img src="/img/example.png" alt="html" height="150" width="100">

Example

<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML img tag</title>
</head>
<body>
    <div>
   		<img src="/img/example.png" alt="html" height="150" width="100">

    	
    </div>
</body>
</html> 


Click on the "Run This Code" button to see how it works.


HTML image Link

HTML image Link , put the <img> tag inside of the <a> tag.

<a href="/index.html">
<img src="/img/example.png" alt="HTML tutorial" style="width:150px;height:150px;">
</a>
  

Example

<!DOCTYPE html>
    <html>
    <head>
        <title>Example of HTML img tag</title>
    </head>
    <body>
        <div>
      <a href="/index.html">
    <img src="/img/example.png" alt="HTML tutorial" style="width:150px;height:150px;">
  </a>
    
            
        </div>
    </body>
    </html> 
    
  


Click on the "Run This Code" button to see how it works.





HTML

Welcome HTML Getting Started HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Links HTML Styles HTML Text Formatting HTML Tables HTML Images HTML Forms HTML Lists HTML Iframes HTML Comments HTML CSS HTML Colors HTML Classes HTML Id HTML javascript HTML Filepaths

HTML Advanced

HTML Doctypes HTML Validation HTML Validation HTML URL HTML URL Encode HTML URL Entities HTML Layout HTML Head HTML Meta HTML Scripts HTML Tags

HTML Media

HTML Media HTML Audio HTML Video HTML Plug-ins HTML Youtube

HTML Graphics

HTML Canvas HTML SVG