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.
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!