【发布时间】:2018-08-31 11:03:20
【问题描述】:
我们如何将 span 元素设为 img 元素?更准确地说,我们如何才能做到这一点,
<span src='https://abs.twimg.com/emoji/v2/72x72/1f607.png'></span>
当我们将表情符号放在 textarea 中时,我在 twitter 消息栏中看到了这个概念。 感谢您的时间和体谅。请看一下,我会很高兴的。
编辑-1
这个问题不是关于使用背景图片。我们可以像推特人那样有其他选择吗?这是我在推特页面上看到的。
<span class="RichEditor-pictographText" title="Smiling face with halo" aria-
label="Emoji: Smiling face with halo" data-pictograph-text="????" data-
pictograph-image="https://abs.twimg.com/emoji/v2/72x72/1f607.png"> 
</span>
这些线条使图像看起来像没有背景图像。
【问题讨论】:
-
span元素在 HTML 中没有有效的src属性。但是使用 javascript 你可以用它做一些事情 -
在推特上他们使用的是
data标签而不是src。data-pictograph-image="https://abs.twimg.com/emoji/v2/72x72/1f62c.png"
标签: javascript jquery html image user-interface