Show/Hid div

Discussion in 'CSS' started by Fracisc, Feb 27, 2009.

  1. #1
    I have 3 radio buttons.

    1. - when clicked, should hide both divs
    2. - when clicked, should display div 2 (only)
    3. - when clicked, should display div 3 (only)

    How can I do that with css? I can do it with JavaScript, but I would prefer CSS.
     
    Fracisc, Feb 27, 2009 IP
  2. DGK

    DGK Peon

    Messages:
    73
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not possible without javascript.

    you can use predefined styles like this:
    .hidden
    {
    display:none;
    }
    .visible
    {
    display:block;
    }

    And then with javascript:
    document.getElementById('divname').className = 'hidden';

    or without CSS - only javascript:
    document.getElementById('divname').style.visibilty = 'hidden';

    Wish you success!
     
    DGK, Mar 5, 2009 IP