Hello,
I am trying to make a .html document that has an image inside it.
I have seen this before, but I don't know how to do it.
The idea is here I don't want a index.html and image.png files, but I want just a index.html that
containd the content of image.png inside it.

Could someone help me?!

Recommended Answers

All 5 Replies

So, aside from using <img /> elements within your HTML document, you could also "embed" an image via CSS using the background-image property assigned to an element on the page.

For example...

<!DOCTYPE html>
<html>
<head>
<title>Demo</title>
<style> 
body {
 background-image:url('images/grid.png')
}
</style>
</head>
<body>

</body>
</html>

[edit]
maybe i misunderstood now that I see paulkd's post. If you are interested in embedding pictures without having to reference a source picture, the link he provided covers that. If that is what you are looking for, there are quite a bit of sites online where you can upload a picture and the output will be a base64 string you can use in your HTML file within the <img /> element for the src attribute..

For example..

<img src="data:image/png;base64,iVBORw0K...." />
[/edit]

I've never done this before and probably never will.

Have a look at this article on Wikipedia

<img src="filename"></img>
this is tag to embed the image in html

commented: you missed the Q entirely, is not a how does the img anchor work, is how does multipart-mime work -3

Thank you for your help. The solution for my problem was:

<img width="320px" height="90px" src="data:image/gif;base64,iVBOsd........" />

glad to hear that you were able to get your question answered and solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.