Adding Images in html

Adding Images In HTML

To add images we use the img tag followed by src attribute. We will discuss about attributes later.
      NOTE- img tag doesn't contain a closing tag.

Syntax-

<img src="your image URL here" alt="alt text to display">

  • In src attribute we give the URL of our image.
  • Writing alt attribute is not necessary.
  • alt attribute text displays if the image fails to load.
  • eg:
      <img src="http://imgur.images.ighdhsa67x" alt="the donut in hands">
  • if the image fails to load due to network issues or something, the alt text "the donut in hands" will be displayed in browser.
  • The images also can be added in lists. they can be added in both ordered and unordered list.
  • For this we only has to give images with <li>......</li> tag.
eg:  <ol>
                <li><img src="image URL" alt="alt text"></li>
                <li><img src="image 2 URL" alt="alt text"></li>
     </ol>

Comments

Popular posts from this blog

Introduction To HTML

Div, Header, Footer and Main