Log in

View Full Version : Achieving Accordion Script Effect with CSS?



Allyria
05-19-2008, 02:31 AM
Hi there,

I've been admiring the Accordion Menu Script (http://http://www.dynamicdrive.com/dynamicindex17/ddaccordionmenu.htm) and I was wondering if there is a way to achieve a similar effect using CSS only?

What I'm really after is to have a submenu open up when the main link is clicked on, then close again on a second click. I doubt it's possible with CSS but here's hoping!

I'm currently only able to achieve a long menu of links with a headers above them to try to break them up into submenus, which looks incredible messy as you can imagine!

Any ideas?

Medyman
05-19-2008, 01:10 PM
No, that can't be done with only CSS. CSS is a styling language. Generally speaking, you can't control interaction with it (unless you count anchors and the use of some pseudo states).

You'll have to use some javascript.