Why img tag is not working? Here are five basic errors.

Sometimes, the image not displaying in the browser. there are many basic errors is, the source of image,
like,
we write img attribute " scr " instead of  "src".

Image tag -
    <img src="foldername/imagename.jpg" width="100%" height="100%">.

In short, there are few possible errors why the browser can't find the image.

1. The image is in one folder up from the HTML document. So, in this case, the image tag should be used like this -
    <img src="../foldername/Imagename.jpg" width="100%" height="100%">.

2. We forget to write extension with image and sometimes write the wrong extension like -

    src="foldername/imagename.png" .
    instead of
    src="foldername/imagename.jpg".

3. The image path is not correct because we forget to write slash and folder name.
   
     Incorrect code -
     <img src="imagename" width="100%"  height="80%">.

     Correct code -
    <img src="foldername/imagename" width="100%"  height="80%">.

4. Sometimes, the system extension is hidden and when we write extension with image, the image
    does not display in the browser.

    So, we have to check whether the system extension is on or off.

5. When we make image gallery, by default the space is shown between the images, like -
 
There is one error in the html code. Usually, we use the img tag like -

  <img src="foldername/imagename"  width="30%"  height="80%">
  <img src="foldername/imagename"  width="30%"  height="80%">
  <img src="foldername/imagename"  width="30%"  height="80%">
  <img src="foldername/imagename"  width="30%"  height="80%">

So, if we do not want to give space between images, the code should be used like this -

  <img src="foldername/imagename"  width="30%"  height="80%"><img       src="foldername/imagename"  width="30%"  height="80%"><img src="foldername/imagename"        width="30%"  height="80%"><img src="foldername/imagename"  width="30%"  height="80%">







Comments

Popular posts from this blog

Why entrance animation not working in Elementor?

Why position relative leaves empty space below the div?

What is difference between GET and POST methods in php?