+1 vote
in Class 10 by kratos

Explain various attributes of image tag.

1 Answer

+3 votes
by kratos
 
Best answer

Attributes of image Tag

An attribute is an extra piece of information associated with a tag that provides further details about the tag.

Following are the various attributes of image tag:

The src Attribute: The src (source) attribute takes URL (Universal Resource Locator) of an image file as value, which points to the direct location of an image to be displayed. The image that you specify in your image tag should be in your computer otherwise the image will not be displayed and in place of image a cross mark in a box 0 will appear.

The alt Attribute: This attribute of image tag is used to provide alternate text when an image on a Web page cannot be displayed. The alternative text is the text associated with an image that serves the same purpose and conveys the same essential message. As per HTML standard, alt attribute is optional but is highly recommended.

The align Attribute: This attribute is used to set the position of an image in a Web page according to the user’* requirements. In HTML, images appear inline with a single line of the text. But, HTML standard does not define a default alignment for the images with respect to other text and images in the same line. There are some values of image alignment attribute as follows:

  1. Top Alignment

  2. Middle Alignment

  3. Bottom Alignment

  4. Left Alignment

  5. Right Alignment

The width and height Attributes: When an image is added to a Web page, it is not mandatory to specify width and height of the image. At the time of loading an image, a box will appear on the place where the image will be loaded.

The border Attribute: You can set the border of an image that you want to use in your Web page. The border attribute of the image tag specifies the width of the border around an image. By default, an image has no border in HTML.

...