Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2009
    Posts
    440
    Thanks
    7
    Thanked 3 Times in 3 Posts

    How to change background color of radio button using CSS ?

    I have been looking around but so far no one has found a way to change the background of a radio button or the button border from the posts I found.

    Can anyone suggest how this might be done ?

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,695
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    It’s not possible. Form controls, and especially radio buttons, checkboxes, and file inputs, are kind of special in that they have limited styling possibilities. Often their look even relies on the operating system in which the browser is used.

    There is an article that is pretty old but still kind of valid, and it shows how different radio buttons (and other form controls) look in different browsers or operating systems. So, even if you were able to change the color in your browser, it doesn’t mean that everyone else is seeing the same.

    That said, the only way to (kind of) reliably customize the look of form controls cross-browser is to replace them with regular elements and using JS to restore the expected functionality. One popular script for this is Niceforms.

  • #3
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,285
    Thanks
    23
    Thanked 611 Times in 610 Posts
    Don't think OP is talking about doing this in a form and not sure if these articles will help but look at:
    How to style Radio Buttons in pure CSS — Andrea PinchiAnd
    This How To Change Radio Button Checkbox Style in CSS
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •