在输入中对单词的字母进行不同的样式设置,可能吗? [英] Styling letters of a word within an input differently, possible?

查看:84
本文介绍了在输入中对单词的字母进行不同的样式设置,可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道这是否可能,但如果我有一个包含文本的输入,例如我们可以在输入中输入Test这个词。我希望能够做的是改变测试一词的单个字母的样式

Wondering if this is even possible, but if I have a input containing text, for example lets say the word 'Test' is in the input. What I would like to be able to do is change the styling on the individual letters of the word 'Test'

我想要' Te '要大胆,然后让'st'成为常规。

I would like the 'Te' to be bold and then have the 'st' be regular.

它不一定是大胆的,也许我希望'e'是红色的或类似的东西。

It wouldn't have to be bold, maybe I would like the 'e' to be red or something like that.

关于如何实现这一点的任何想法?

Any ideas on how this might be accomplished?

推荐答案

唐我认为这是可能的(会做更多的测试)。

Don't think it is possible (will do some more test).

如何添加一个看似输入的可信div?

What about adding a contenteditable div which looks like a input?

简单的可满足的例子: http://jsfiddle.net/PpEx7/

Simple contenteditable exmaple: http://jsfiddle.net/PpEx7/

编辑

Nopez不可能。 :)

Nopez not possible. :)

这篇关于在输入中对单词的字母进行不同的样式设置,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆