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

<html>

<body>

<center>Image tag Example</center>

<img src="https://phpgurukul.com/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.

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy