HTML - Images

  • HTML <img> tag is used to display  images in the web page.
  • The images are just linked, not inserted into the web page. The <img> creates a holding space for the image.
  • The <img> tag is an empty tag that doesn't have a closing tag. It contains only attributes.
  • The required attributes of the <img> tag are
    • src - Specifies the path of the image
    • alt - Specifies alternate text for the image
      <img src="url" alt="alternate-text">
  • List of other optional attributes of the <img> tag
    • border - sets a border for the image by specifying in pixels.
    • width, height - define width and height of the image in pixels or percentage.
    • vspace, hspace - define the horizontal and the vertical space between the text and the image when text is wrapped around the image.
    • align - defines the image alignment.
    <!DOCTYPE html>
    <html>
      <head>
         <title>HTML Image Example</title>
      </head>
      <body>
        <img src="img/v-color.jpg" width="30%" height="30%" align="center" vspace="5" hspace="10"> 
        <p>Buy T-shirt</p>
      </body>
    </html>

    Output:
    HTML Image example

    No comments:

    Post a Comment

    You might also like

    Deploy your Django web app to Azure Web App using App Service - F1 free plan

    In this post, we will look at how we can deploy our Django app using the Microsoft Azure app service - a free plan. You need an Azure accoun...