IMAGE TAG


php tutorial

HTML IMAGE TAG

php tutorial

<img> Tag define an image in html page. It has many attributes to represent image in web world. There are three types of image used in HTML, indicated by different filename extensions: .jpg, .gif and .png (also known as JPEGs, GIFs and PINGs).

IMG Tag Attributes List
img tag attributeDefinition
srcImage path as absolute path ( as URL) or relative path (as image path)
altSpecifies alternate text
heightImage Height in pixels or %
widthWidth in pixels or %
borderWidth of image border

Browser Support to <img> tag : Chrome, Firefox, IE, Opera, Safari
Syntax:
<img src =”path” height =”px or %” width =”px or %” alt =”Description”border =”title” title =””/>

The examples below show how we use <img> tag

height, width attribute


Height 120px Width 150px
Tag: <img src =”images/imgtag.png” height =”120px” width =”150px” />

alt & title attribute

img tag in php tutorial
Need to move mouse pointer over the image then title will display over it.

Tag: <img src =”images/imgtag.png” height =”120px” width =”150px” title =”Title of Image” />

border attribute

img tag in php tutorial
increase thickness surrounding image by border attribute

Tag: <img src =”images/imgtag.png” height =”120px” width =”150px” style =”border:2px solid red;” />