简体   繁体   English

图片上方的可编辑文字

[英]Editable Text Over Image

I was wondering, is there a way of getting text to go over an image, but have it so that the text can be changed without going into the html, aka using a textbox from a form displayed on the webpage, and the inputted text being put on the image? 我想知道,是否有一种方法可以使文本遍历图像,但是有一种方法可以更改文本而无需进入html,也可以使用网页上显示的表单中的文本框,并且输入的文本放在图像上? i know it can be done but im struggling on where to start, and any reply pointing me in the right direction would be most gratefully recieved. 我知道这是可以做到的,但我在从何处入手方面苦苦挣扎,如果能向我指出正确的方向,我将不胜感激。

Gareth 加雷斯

If browser compatibility is not an issue, this can be done with HTML5 like so: 如果浏览器兼容性不是问题,可以使用HTML5来完成,如下所示:

<div contenteditable="true">
   This text can be edited by the user.
</div>

Then you could either set the image as the background image for that div, or place the image within that div but set the z-index lower than that of the text. 然后,您可以将图像设置为该div的背景图像,或者将图像放置在该div内,但将z索引设置为低于文本索引。

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

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