Skip to content
html tutorial
Menu
  • About us
  • Disclaimer
  • Privacy Policy
Menu
HTML Images Tag

HTML Images Tag

Posted on January 27, 2023

HTML images are one of the most common elements used in web design. The HTML img tag is used to embed images in a web page. The tag requires a source attribute, src, that specifies the URL of the image file.

Here is an example of how to use the img tag:

<img src="image.jpg" alt="A beautiful landscape">

In this example, the src attribute points to an image file called “image.jpg”. The alt attribute provides a text description of the image, which is displayed if the image cannot be loaded or if the user is using a screen reader.

It is also possible to specify the width and height of an image using the width and height attributes. For example:

<img src="image.jpg" alt="A beautiful landscape" width="500" height="300">

This will display the image with a width of 500 pixels and a height of 300 pixels.

It is also possible to use the CSS to style the images. for example :

<img src="image.jpg" alt="A beautiful landscape" class="img-responsive">

and in CSS :

.img-responsive{
    width: 100%;
    height: auto;
}

This will make the image responsive to the screen size.

In conclusion, the HTML img tag is a powerful tool for adding images to a web page. It allows you to specify the source of the image, as well as its size and alternative text. And you can use CSS to style the images and make it responsive to the screen size.

Leave a Reply Cancel reply

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

Recent Posts

  • HTML Text Formatting

    HTML Text Formatting

    January 28, 2023
  • <strong>HTML a tag- Anchor Tag</strong>

    <strong>HTML a tag- Anchor Tag</strong>

    January 27, 2023
  • HTML Paragraphs: The building blocks of web content

    HTML Paragraphs: The building blocks of web content

    January 17, 2023
  • HTML Heading tags

    HTML Heading tags

    January 17, 2023
  • HTML Attributes

    HTML Attributes

    January 16, 2023
  • HTML Elements

    HTML Elements

    January 16, 2023
  • All HTML code editors and how to use it.

    All HTML code editors and how to use it.

    January 14, 2023
  • HTML Introduction (What is HTML?)

    HTML Introduction (What is HTML?)

    January 8, 2023
©2023 HTML TUTORIAL | Design: Newspaperly WordPress Theme