2013-02-09 77 views
1

我已经试过这一点,但它不会在文字区域:(情况下工作(在Chrome和IE)关于如何更改textarea选择颜色的任何想法?

::-moz-selection { 
    background: #b3d4fc; 
    text-shadow: none; 
} 
::selection { 
    background: #b3d4fc; 
    text-shadow: none; 
} 

在那里有可能进制方式?
CSS或jQuery的任何如何?

+0

其他,你已经已经什么试过,没有办法修改浏览器选择公司阴沉。 – 2013-02-09 11:37:40

+0

嗯我认为相同,但让我们看看是否有人有想法.. – john 2013-02-09 11:39:24

回答

0

你试图改变它里面的文字textarea或只是颜色的背景颜色如果是后者,那么这就是你想要什么?

::-moz-selection { 
    color: #b3d4fc; 
    text-shadow: none; 
} 
::selection { 
    color: #b3d4fc; 
    text-shadow: none; 
} 

正如在这里看到:http://jsfiddle.net/u6CNN/

顺便说一下,您也可以指定background-color

+0

我想你正在试图在Firefox上变瘦。所以请检查Chrome或IE – john 2013-02-09 11:46:49

4

这仅在Firefox(和Safari?)中受支持。

您可以做一个解决方法。而不是textarea使用div with contenteditable。

参见:http://jsfiddle.net/VF4tb/1/

+0

我知道它适用于Firefox。但尝试在Chrome或IE浏览器! – john 2013-02-09 11:47:40

+0

改变了我的答案,希望这有助于;) – bpoiss 2013-02-09 12:06:58

+0

它在文本上,但不是在Chrome上的输入/ textarea ... 是啊contenteditable'll做诡计! – soyuka 2013-02-09 12:07:07

-1

如果我理解正确的话,你想改变一个textarea的背景色,对不对?

是这样的:

textarea{ 
    /* Change the color of the typed text in the textarea */ 
    color: #CCC; 

    /* Change the background color of the actual textarea */ 
    background-color: #000; 
} 

或类:

CSS->

.classname{ 
    /* Change the color of the typed text in the textarea */ 
    color: #CCC; 

    /* Change the background color of the actual textarea */ 
    background-color: #000; 
} 

HTML的“

<textarea class="classname"> 
</textarea>