Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to change bg color of ‘input’ text selection

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #28145
    psychotronic
    Member

    Hi all,
    I have a problem and I hope I can find a solution here
    What i want to do is quite simple. this screenshot maybe can explain the problem better :
    [img]http://img411.imageshack.us/img411/2100/changeo.jpg[/img]

    I want to change the background color for text selection of the input text.
    Is it possible to be done?

    I have tried the css code

    Code:
    ::selection {
    background: #ffb7b7; /* Safari */
    }
    ::-moz-selection {
    background: #ffb7b7; /* Firefox */
    }

    but no luck :(

    thanks !!

    #71577
    psychotronic
    Member
    "virtual" wrote:

    heheh , i think you ‘ve misunderstood me :p .

    Please re-read my question. I’m not looking for something fancy attribute for my form, styling, jquery-ing or something like that.
    I just want to find how, to change background color of any text selection, where the text is placed inside a input text or text area.

    Of course I have googled it before, but maybe I missed it :p . So I will really appreciate if you can show me the exact solution, url, manual etc, not just letting lmgtfy.com do that for me ;)

    #71628
    Nipperkin
    Member

    The property "background" is correct, at least that’s how I’ve done what you’re trying to do (see http://inanindeterminateplace.com/contact/ for an example).

    That said, what is the :: doing there? Could that be the problem?

    #71634
    psychotronic
    Member
    "Nipperkin" wrote:
    The property "background" is correct, at least that’s how I’ve done what you’re trying to do (see http://inanindeterminateplace.com/contact/ for an example).

    That said, what is the :: doing there? Could that be the problem?

    thank you for your reply;)

    please see the screenshot of your contact form :
    [img]http://img23.imageshack.us/img23/9000/bluebg.png[/img]

    I want to change the bacground color of selexted text "Lorem ipsum bla bla"
    Hope you can see what I mean :)

    #71638
    Nipperkin
    Member

    Sorry, I didn’t read you closely enough (:oops: ) and don’t have a solution. I sniffed around a bit and found many pages on changing text selection colors giving the code you tried, but none on changing selection colors in input fields…

    #71645
    TheDoc
    Member

    Just to make sure everyone is on the same page, the OP is referring to this:

    https://css-tricks.com/overriding-the-de … -with-css/

    #71715
    psychotronic
    Member

    thank you all for the helps, i really appreciate it ;)

    "virtual" wrote:
    Well unless I am misunderstanding you again, how about this
    http://www.cssplay.co.uk/menu/form.html
    No.1 CSS Play has a background image in the input boxes and No. 5 changes on hover.

    sorry, it doesn’t work virtual. It just changing the input background, not the selection colors

    "TheDoc" wrote:
    Just to make sure everyone is on the same page, the OP is referring to this:

    https://css-tricks.com/overriding-the-de … -with-css/

    Yes, it’s working good with p, div etc, but not with the selection color of input fields.

    Please see the image below :
    [img]http://img132.imageshack.us/img132/125/ikoko.png[/img]

    this is my styling code :

    Code:

    It wrks properly with the <p> and other html element, but not with the input field / text area

    #71746
    TheDoc
    Member

    I don’t think you actually can. If you look at CSS-Tricks, you’ll see that all of the input areas use a standard blue.

    #71759
    psychotronic
    Member
    "TheDoc" wrote:
    I don’t think you actually can. If you look at CSS-Tricks, you’ll see that all of the input areas use a standard blue.

    Yup I see. How about using javascript. Is it possible?

    thanks

    #107196

    You are forgetting the color!

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘CSS’ is closed to new topics and replies.