Possible to change appearance of radio button with css?

Discussion in 'HTML' started by Brian Cryer, Mar 26, 2007.

  1. Brian Cryer

    Brian Cryer Guest

    I think the answer to this is no, but it wouldn't be the first time I was
    wrong, so ...

    Question: Is it possible to change the appearance of a radio button using
    css? What I'm actually after is the ability to change the button to look
    like a tick-box, so changing the image used.

    This came up when a colleague was talking to me about a small project. His
    requirement is for the functionality of radio buttons but the appearance of
    tick-boxes. I know this could be done using some JavaScript, what I was
    wondering was whether there was a solution that didn't rely on client side
    scripting.

    Thanks.
    --
    Brian Cryer
    www.cryer.co.uk/brian
    Brian Cryer, Mar 26, 2007
    #1
    1. Advertising

  2. Scripsit Brian Cryer:

    > Question: Is it possible to change the appearance of a radio button
    > using css?


    Absolutely maybe. It depends. You might be able to change their size, for
    example, by setting the width and height properties. You cannot change most
    aspects of rendering of radio buttons, though, thank &Deity;.

    > His requirement is for the functionality of radio buttons
    > but the appearance of tick-boxes.


    That means intentionally misleading people. Interesting functionality.

    > I know this could be done using
    > some JavaScript, what I was wondering was whether there was a
    > solution that didn't rely on client side scripting.


    You could do this by using a <noscript> element containing normal radio
    buttons (so the page would actually _work_ when JavaScript is disabled) and
    some JavaScript code that adds a set of images into the document tree and
    associates onclick handlers with them, so that when clicked on, the image
    changes and the form data is changed too.

    Of course, the approach would break the normal functionality of radio
    buttons in keyboard-only use, among other things.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Mar 26, 2007
    #2
    1. Advertising

  3. Brian Cryer

    Andy Dingley Guest

    On 26 Mar, 12:16, "Brian Cryer" <brian.cr...@127.0.0.1.ntlworld.com>
    wrote:

    > Question: Is it possible to change the appearance of a radio button using
    > css?


    Usually yes, but only in minor ways. Most of the presentation of UI
    controls is dependent entirely on the browser and only minor
    properties (such as background-color) are amenable to change through
    CSS.

    Some browsers may support additional CSS properties to set more
    properties on an control, but these are browser-specific (AFAIR,
    there's a bunch of these for Mozilla)
    Andy Dingley, Mar 26, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bruce barker
    Replies:
    1
    Views:
    1,327
    David
    Aug 13, 2003
  2. Scott D Johnson
    Replies:
    1
    Views:
    1,050
    Scott D Johnson
    Sep 27, 2006
  3. Nils M. Lunde

    Change "Enabled" appearance for a LinkButton

    Nils M. Lunde, Oct 30, 2003, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    170
    James Radke
    Oct 31, 2003
  4. TJS

    change appearance of item in listbox

    TJS, Jan 16, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    105
  5. Hiten
    Replies:
    1
    Views:
    611
    Vidar Petursson
    May 26, 2004
Loading...

Share This Page