Computer Science, asked by Bantishaikh3570, 11 months ago

Define following attribute of image tag height and width

Answers

Answered by Dipanshu2006
1

Answer:

The <img> Tag

The <img> tag is used to insert an image. It contains only attributes, and does not have a closing tag.

The image's URL (address) can be defined using the src attribute.

The HTML image syntax looks like this:

<img src="image.jpg" />

<html>

<head>

<title>first page</title>

</head>

<body>

<img src="tree.jpg" alt="" />

</body>

</html>

In case the image cannot be displayed, the alt attribute specifies an alternate text that describes the image in words. The alt attribute is required.

Image Resizing

To define the image size, use the width and height attributes.

The value can be specified in pixels or as a percentage:

<html>

<head>

<title>first page</title>

</head>

<body>

<img src="tree.jpg" height="150px" width="150px" alt="" />

<!-- or -->

<img src="tree.jpg" height="50%" width="50%" alt="" />

</body>

</html>

Loading images takes time. Using large images can slow down your page, so use them with care.

Image Border

By default, an image has no borders. Use the border attribute within the image tag to create a border around the image.

<img src="tree.jpg" height="150px" width="150px" border="1px" alt="" />

Similar questions