Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save image content inside html file [duplicate]

Tags:

html

css

image

Is it possible to save image inside html? I want to create html with a few images. Maybe I need to decode image content with base64 and paste it in html markup?

like image 950
mystdeim Avatar asked Apr 24 '13 12:04

mystdeim


People also ask

Can I use same image twice in HTML?

Yes you can ! ex: background:url(wnaderknight. png) 25px 25px no-repeat, url(wnaderknight.

How do you duplicate an image in HTML?

CTRL C + CTRL V.


2 Answers

Yes its possible, check this simple example: http://jsfiddle.net/MH7gF/

<img alt="" src="data:image/png;base64(...)" />

There is also simple converter.

like image 63
Kasyx Avatar answered Oct 07 '22 17:10

Kasyx


it seems you are looking to use CSS Data URI's. http://css-tricks.com/data-uris/ you need to encode your image to base64 and set it using one of these data URI's within the HTML or the CSS as it works with both.

<img width="16" height="16" alt="star" src="data:image/gif;base64,..." />

li { 
  background: url(data:image/gif;base64,...) no-repeat left center;
}
like image 44
bizzehdee Avatar answered Oct 07 '22 17:10

bizzehdee