DEV Community

Cover image for Create Accordion in HTML CSS & JS
codinglabweb
codinglabweb

Posted on

Create Accordion in HTML CSS & JS

How do you create an accordion using HTML, CSS, and JavaScript?

Hello Readers, we are going to learn How to Create an Accordion using HTML CSS, and JavaScript. This accordion will be fully responsive. There are several projects that I have created before like Complete website, Drop-down Navigation Menu, Login Form, Cards so on, but till I had not created any accordion. So That's why without further ado let's get started.

What is Accordion?
Accordion is the box on the webpage that contains mainly text article and have drop-down features. Accordion takes a small area and that displays only questions to the user, if the user wants to read the answer then they need to open it by clicking or doing a hover on the question.

As we can see on the webpage of google, when we search for something there on the news feed we see one section as a People Also Ask right? that section is called accordion.

Basically accordion contains five headings and we have to click on that heading to see an answer or more headings. You would be thinking what is heading, Look at the Image of accordion that I have given on the webpage, there are total five-question, that is called headings.

Responsive Accordion | Source Code

You can download all source code from the given link. Click Here To Download All Source Code

Top comments (1)

Collapse
 
thomasbnt profile image
Thomas Bnt ☕

Hey 👋🏼

This looks like a good post here. Can you share this in full on DEV?

DEV generally asks that folks share their posts in full if possible and there is tooling provided to make it so that it's relatively easy to repost from outside blogs.

Hope you'll consider sharing the full post going forward.