HTML Image (img)

Images are very essential to beautify your website. These are helpful to show many complex concepts in an easy way on your web page. In HTML, img tag is used to show the image on the web page. This tag is an empty tag that includes attributes only, closing tags are not used in the HTML image tag.

HTML Image Tag Attributes:

The src and alt are essential attributes of the HTML img tag. All the attributes of the HTML image tag are given below.

1) src: It is a crucial attribute that shows the source or path of the image. It instructs the browser where to look for the image on the server. The image location may be in the same directory or another server.



2) alt: The alt attribute determines an alternate text for the image, if it can’t be displayed. The value of the alt attribute defines the image in the words. The alt attribute is considered as a good from the SEO point of view.

3) width: It is an optional attribute, which is used to indicate the width to display an image. It is not suggested now. You should apply in the CSS file in a location of the width attribute.

4) height: It denotes the height of the image. The HTML height attribute also supports the iframe, image and object elements. It is not compulsory now. You should apply in the CSS file at the place of the height attribute.

Syntax: <img src=”image-name.jpg”>

img Attribute are given below:

src – it the URL of an image
alt – it specifies an alternate text for an image
height – it specifies the height of an image
width – it specifies the width of an image

align(top, bottom, middle, left, right) – it specifies the alignment for the image.

Format of Image – .jpg, .png, .gif etc.


Example:

<!DOCTYPE html>
<html>
<body>

<h2> How put image in HTML Web Page </h2>

<img src="image-name.jpg" style="width:150px; height:150px;">

</body>
</html>

Coding Tag

Coding Tag always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

avatar
  Subscribe  
Notify of