HTML Images
HTML has tag to display images on the web pages or web applications. This tag is an empty tag i.e. we don’t have to close this tag while using it.
Example
1 2 3 4 5 6 7 8 9 10 11 |
<html> <body> <center>Image tag Example</center> <img src="http://localhost/wordpress/wp-content/uploads/2016/05/phpgurukul-1.png" alt="phpgurukul"/> </body> </html> |
Attributes of the Image tag
src: It is the most important attribute of the image tag which allows describing the source or path of the image. Source attributes instruct the browser where to look for the image source. Image source can be on the same directory or server which can be local or global.
alt: It stands for alternate text which describes the information about the image but the text is visible only when the image is not loaded due to
any type of error.
Height: This attribute allows the user to decide the height of the image. The value provided to this attribute is either in “Pixel” or “Percentage”.
Width: It allows the programmer to fix the width of the image. The value provided is similar to the height attribute.