Skip to main content

Posts

Showing posts with the label base64 encoding

Embed Images Directly into HTML

In HTML, images are defined with the <img> tag. <img src="url" alt="some_text"> The src attribute defines the url (web address) of the image. The alt attribute specifies an alternate text for the image, if it cannot be displayed. If you want to show an image, you write something similar to this in your HTML : <img src="html5_sticker.png" alt="HTML5 Sticker"> But, sometimes you may want to show an image on your webpage but you don't want to link an external image file. In that case, you can directly embed your image into the HTML without having to link to an external file. The idea behind it is that the browser interprets the image file in encoded format. So why not we directly put the encoded data in the src attribute of <img> tag. One of the advantages of embedding the image directly into the HTML is Portability. There are so many online Base64 Image encoder available on the web. Just google it and y