简体   繁体   English

是否可以将图像嵌入HTML格式?

[英]Is this possible to embedded an image in HTML form?

Is that HTML form only support pure text only? HTML表单仅支持纯文本吗? Can I use some JS / CSS trick to let the HTML form have image embedded? 我可以使用一些JS / CSS技巧来让HTML表单嵌入图像吗?

What do you mean by "image embedded"? “图像嵌入”是什么意思?

If it's only for decoration, you can put it before or after the form and position it with CSS as needed. 如果仅用于装饰,则可以将其放在表单之前或之后,并根据需要使用CSS进行定位。

If you mean, submit an image (or any kind of file) then use input type="file". 如果您的意思是,提交图像(或任何类型的文件),然后使用输入type =“ file”。

Regarding image directly in form, it may work but I'm not sure the document will validate. 对于直接以表格形式显示的图像,它可能有效,但是我不确定文档是否会通过验证。 Better check it out. 最好检查一下。

If you mean embedded image in base64 for example, it is not possible. 例如,如果要在base64中嵌入图像,则不可能。 You have to link a file and you cannot create a file in Javascript. 您必须链接文件,并且不能使用Javascript创建文件。

This Html Code Works Like Img But Can Show Any File Your Browser Supports. 该HTML代码的工作方式类似于图,但可以显示浏览器支持的任何文件。 I Tested This iframe Myself. 我自己测试了这个iframe。

 <iframe src="(Your Base 64 Code)"></iframe> 

This Site is Not My Creation. 这个网站不是我的创造。 Use This Link To Convert Any File To Base64 使用此链接将任何文件转换为Base64

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM