Alignment of Image in HTML

The Tutorial illustrates an example from Alignment of image in HTML. In this Tutorial, the code explain an alignment of image in HTML.

Alignment of Image in HTML

Alignment of Image in HTML

     

The Tutorial illustrates an example from Alignment of image in HTML. In this Tutorial, the code explain an alignment of image in HTML. For this we start with a<html> tag, which explain the html document type. Inside the html tag we have a title tag name aligning Images.

The <body bgcolor> : is used to define the background color of HTML page.

<img src> :The <img src> is used  to define the image location .The source file from which image is to be taken.

<align> : The <align> is used to define the alignment of the image. This define the different position of image in the HTML page. The alignment of images define different location i.e top, middle and bottom.

 

 

The code is saved with .html extension.

<html>
<head><title>aligning Images</title></head>
<body bgcolor="lightblue">
<p>This image is aligned <img src="roop.gif" height="100" width="100" align="top"> top within the text.</p><hr size="3" color="red"/>
<p>This image is aligned <img src="roop.gif" height="100" width="100" align="middle"> top within the text.</p><hr size="3" color="red"/>
<p>This image is aligned <img src="roop.gif" height="100" width="100" align="bottom"> top within the text.</p>
</body>
</html>

 

Place the path of saved html code in address bar of your browser and run the code.

Output is displayed as

 

This image is aligned      top within the text.

This image is aligned  middle within the text.

This image is aligned bottom within the text.

 

 

Download