html5 - How to Encode an Image into an HTML file -


this question has answer here:

so may weird question, bear me. designing block of code website. creating

<div></div> 

element content inside it. style tags included within it, script tags. ease of design, wish html file script , css inside of it. have background image using. used elsewhere on webpage, , should show when code inserted website> however, since have no way of verifying this, include image html file. not talking image tag (as below)

<img src='image.jpg/> 

i talking somehow including or encoding image physical html file, there isn't separate html file , jpeg file, 1 html file. possible? if so, how?

edit: base64, can rather long, , add whole bunch of length html file. there other possible solutions?

you can base64 encode image data, end this

<img src="data:image/gif;base64,r0lgodlhdwapakecaaaazmzm///// waaacwaaaaadwapaaaciispeqhsrz5modrlln48cxf8m2iq3ymmkqvlrtw4ml wwach+h09wdgltaxplzcbiesbvbgvhzcbtbwfydfnhdmvyiqaaow==" alt="base64 encoded image" width="150" height="150"/> 

here resources:

base64 image converter

http://www.bigfastblog.com/embed-base64-encoded-images-inline-in-html

embedding base64 images


Comments