-1

Suppose I have to deliver an HTML file and I can't host the images externally and I also can't reference a local file. Is there some way I can embed the information of the image in the HTML file itself? Let me know if I need to explain my question better.

Subpar Web Dev
  • 3,210
  • 7
  • 21
  • 35
  • This isn't `Questions seeking debugging help ("why isn't this code working?") must include the desired behavior,..`, it is a question about whether a specific capability exists for HTML. It's also a very reasonable question that many junior and mid-level HTML developers don't know the answer to. – Eric J. Jan 26 '16 at 21:45
  • I agree it's a duplicate though. Didn't see that one mentioned under Related before answering. – Eric J. Jan 26 '16 at 21:50

1 Answers1

1

Yes, you can use a data URI.

Did you know that you don't have to link to an external image file when using an <img> element in HTML, or declaring a background-image in CSS? You can embed the image data directly into the document with data URIs.

The link also recommends an online tool to generate a data URI from an image. There are many such tools a google search away.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Eric J.
  • 147,927
  • 63
  • 340
  • 553