views:

300

answers:

3

Hey folks!

I've been looking for this throughout the web and can't even find anyone else even asking this, let alone a solution...

Is there a way to change the color of the highlight area within a a text input when text is selected? Not the highlight border or the background, but the portion that appears around the text when you have the text actually selected.

+4  A: 

If you are looking for this:

alt text

Here is the link:

http://css-tricks.com/overriding-the-default-text-selection-color-with-css/

Sarfraz
That's not exactly what I'm looking for, though it's definitely a nice thing to know. I need to do that but inside of a text input box. I tried applying the code from the examples to an input and that didn't work.
Eric
@Eric: I am afraid it can't be done inside the textbox as i have never come across such thing, may be some else has.
Sarfraz
A: 

This appears to do what you're after, via javascript: http://www.dhtmlgoodies.com/index.html?whichScript=highlight-active-input

I can't vouch for it, but a quick test in FF3.5.7 seems to work OK. Good luck.

graphicdivine
Actually, my bad, on second thoughts I don't think this does what you want after all. Sorry.
graphicdivine
A: 

Thanks for the links, but it does seem as if the actual text highlighting just isn't exposed.

As far as the actual issue at hand, I ended up opting for a different approach by eliminating the need for a text input altogether and using innerHTML with some javascript. Not only does it get around the text highlighting, it actually looks much cleaner.

This granular of a tweak to an HTML form control is just another good argument for eliminating form controls altogether. Haha!

Thanks again!

E

Eric