Mark
Mark

Reputation: 2542

Show Hide Button with CSS only

I am trying to simulate an accordion menu in CSS.

I cannot use javascript for a variety of reason, so its CSS only.

Is there some simple code to show/hide a div on the click of a button

Upvotes: 1

Views: 2980

Answers (3)

Mike Sav
Mike Sav

Reputation: 15291

If you're looking for a pure CSS accordion this article and demo may help...

https://catalin.red/dist/uploads/2011/05/css3-accordion.html

https://catalin.red/css3-accordion/

Upvotes: 6

James Healey
James Healey

Reputation: 464

I believe it can be done with CSS3, but not all browsers support animations. Here's the best I could find that explicitly states no Javascript.

http://featofdesign.com/stephen/2011/06/16/css3-simple-slideout-accordion-menu/

Upvotes: 1

Cobo
Cobo

Reputation: 118

I don't think you can make it behave like an actual accordion without javascript.

About the best thing you could do is to make every menu option collapsed and on hover make it expand, but as soon as you hover out, the menu option will collapse again.

Upvotes: 0

Related Questions