HTML Images

HTML allows you to include images in your web pages using the <img> tag. The <img> tag is an empty tag, which means it does not require a closing tag.

Here is the basic syntax for including an image in HTML:

<img src="image-url.jpg" alt="image description">

In this example, the src attribute specifies the URL of the image, and the alt attribute provides a description of the image in case it cannot be displayed.

Here are some other important attributes you can use with the <img> tag:

  • width and height: These attributes specify the width and height of the image in pixels.
  • title: This attribute provides additional information about the image, such as a tooltip that appears when the user hovers over the image.
  • align: This attribute specifies how the image should be aligned with respect to the text around it.

Here’s an example of using these attributes:

<img src="image-url.jpg" alt="image description" width="300" height="200" title="A beautiful sunset" align="right">

This would display an image with a width of 300 pixels, a height of 200 pixels, aligned to the right, with a title that says “A beautiful sunset”.

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *