Jump to: navigation, search

HTML images

From w3cyberlearnings

Contents

HTML - img Tag

<img> tag defines the image in the HTML page.

HTML - Syntax img tag

  • src: set the path to the image
  • alt: alternative for the image
  • height: set the image height
  • width: set the image width
<img src="path/image.gif" alt="text" height="40" width="40" />

img- Attributes

Attributes value Example Description
src url <img src="url/image.gif"/> Set the URL to an image
alt text <img src="url/image.gif" alt="this is my pix"/> Alternative text for an image
width number <img src="url/image.gif" width="40"/> Set image width
height number <img src="url/image.gif" height="40"/> Set image height
ismap ismap <img src="url/image.gif" ismap="ismap"/> Set an image as a server side image map
longdesc url <img src="url/image.gif" longdesc="mylove.txt"/> specifies the text for more information about an image

Example 1 TRY-IT

<html>
	<head>
		<title>Image 1</title>
	</head>
	<body>
		<img src="myhome.png" width="420" height="120"/><br/><br/>
		<img src="myhome.png" width="230" height="80"/><br/><br/>
		<img src="myhome.png" width="120" height="80"/>
	</body>
</html>

Output

Html image 1.png

Related Link



Navigation
Web
SQL
MISC
References