How to include an image with no src with HTML?

Spread the love

Sometimes, we want to include an image with no src with HTML.

In this article, we’ll look at how to include an image with no src with HTML.

How to include an image with no src with HTML?

To include an image with no src with HTML, we set the src attribute to the base64 URL.

For instance, we write

<img
  src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="
  width="0"
  height="0"
  alt=""
/>

to set the src attribute to a base64 URL with a GIF.

Conclusion

To include an image with no src with HTML, we set the src attribute to the base64 URL.

Leave a Reply

Your email address will not be published.