如何使值形式的文本是斜体 [英] How to make value text in form be italic

查看:98
本文介绍了如何使值形式的文本是斜体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本,当用户在字段中单击时,会删除表单中的默认值文本,但是如何使值文本以斜体显示?如果我将我的css中的输入更改为font-style:italic,那么当用户键入它时,它也以斜体显示,我只想让用户输入时的预览文本为斜体,然后正常。

http://tylerbrockphotography.com/contact1.php

解决方案

不幸的是,您需要为每个引擎使用不同的选择器。



< pre class =lang-css prettyprint-override> #box :: - webkit-input-placeholder {font-style:italic; }
#box :: - ms-input-placeholder {font-style:italic; }
#box :: - moz-placeholder {font-style:italic; }

这是一个演示!


I have a script that erases the default value text in the form when the user clicks in the field, but how can I make the value text appear in italics? If I change the input in my css to font-style:italic then when the user types it appears in italics too and I just want the "preview text" to be in italics and then normal when the user is typing.

http://tylerbrockphotography.com/contact1.php

解决方案

You need to use a different selector for each engine, unfortunately.

#box::-webkit-input-placeholder { font-style: italic; }
#box::-ms-input-placeholder { font-style: italic; }
#box::-moz-placeholder { font-style: italic; }

Here’s a demo!

这篇关于如何使值形式的文本是斜体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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