是否可以设置输入文本的值? [英] is it possible to style a value of an input text?

查看:87
本文介绍了是否可以设置输入文本的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以设置输入框的值... 。 as:

 < input class =textBoxtype =text =Inserisci il< span style = value =Inserisci il< span style ='color:#c83243;'> titolo< / span> per l'URL personalizzatoname =ctl00 $ InsertDati1 $ txtTitolo> 

但它不会呈现span元素。任何建议?

解决方案

您可以在输入框中设置样式。例如:

 输入{
颜色:#ff0000;
字体:1em / 1.25em Arial,Helvetica,sans-serif;

$ / code>

如果您想使用占位符内容,您可以添加一个

 < input type =textclass =textboxplaceholder = 'Title'/> 

请注意,占位符仅适用于支持HTML5和占位符属性的浏览器。如果您希望兼容旧版浏览器,并且不介意使用某些JQuery,则可以使用JQuery插件,如 JQuery Watermark

然而,你不能将span元素放在输入的标记。


I'd like to know if is possible to style a value of an input box... such as :

<input class="textBox" type="text" rel="Inserisci il <span style=" value="Inserisci il <span style='color:#c83243;'>titolo</span> per l’URL personalizzato" name="ctl00$InsertDati1$txtTitolo">​​​​​​​​​​​​​​​​​​​​​​​​​​​​

but it doesnt render the span element. Any suggestions?

解决方案

You can style the content within an input box. For eg:

input{
    color:#ff0000;
    font: 1em/1.25em Arial, Helvetica, sans-serif;
}

If you want to use placeholder content on the other hand, you can add a 'placeholder' attribute on the input tag like so:

<input type="text" class="textbox" placeholder='Title' />

Note that placeholders only work in browsers that support HTML5 and the placeholder attribute. If you want compatibility for older browsers and dont mind using some JQuery, you can use a JQuery plugin like JQuery Watermark.

You can't however, place span elements within the value of an input tag.

这篇关于是否可以设置输入文本的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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