IMAGE-TAG
Image Tag
HTML img tag is used to display image on the web page. HTML img tag is an empty tag that contains attributes only, closing tags are not used in HTML image element.Example
<html>
<head>
<title>image</title>
</head>
<body>
<img src="logo.jpg" alt="logo">
</body>
</html>
Output
image Attribute
| Attribute | Value | Description |
|---|---|---|
| src | image address | the url of an image |
| alt | text | alternate text(image name) for the image, if it can't be displayed |
| width | pixel(px) or percentage(%) | It is used to specify the width of the image. |
| height | pixel(px) or percentage(%) | It is used to specify the height of the image. |
| align | top,bottom,middle,left,right | Specifies the direction for the image. |
Example-align
<html>
<head>
<title>image</title>
</head>
<body>
<img src="logo.jpg" align="right">
</body>
</html>
Output
Example-alt
<html>
<head>
<title>image</title>
</head>
<body>
<img src="logo.jpg" alt="logo">
</body>
</html>
Output
(if image not display alt tag print image name which you specified with in alt attribute)
Example-width or height
<html>
<head>
<title>image</title>
</head>
<body>
<img src="logo.jpg" width="400" height="550">
</body>
</html>
Output
Example-float property
<html>
<head>
<title>image</title>
</head>
<body>
<img src="logo.jpg" >
<p> this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.</p>
</body>
</html>
Output
this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.this is demo text.