Yellow oilseed rape flowers in a field with hills behind

7 October 2021

Build an Accordion Without JavaScript

by

isev Team

isev Team

accordion-v2
In the pursuit of web performance, we are all looking to come up with clever solutions to make our websites load faster. One way many of us do this is coming up with and stealing (which in this case, the latter is more appropriate) ways of writing less JavaScript.

Many websites I work on include an FAQ section, and nine times out of ten I end up building some form of accordion. But recently I saw a method of building a mobile menu without the use of JavaScript, and I wondered if I could use the same method to build an accordion.

See the Pen Building an Accordion without JavaScript – Part I by Michael (@mjtweaver) on CodePen.

The above pen really simply demonstrates how we can achieve this. We use the label to use as the question, and we also include a checkbox. The checkbox is hidden from view. When we click on the label, it checks the input and then we can use this to display the answer. You’ll notice here we use the general sibling combinator or ~. I wrote some more information on this here. The above example was very simple, how about a styled up version?

After searching on Google, I know others have also used this solution in the past, so it may not be new to you, but it would interesting to get your thoughts.

As a note on browser compatibility, the only thing you have to really consider is the general sibling selector, information can be found here.

Continue Reading

Woman packing a parcel at a workbench in a small stockroom
11 Signs Your Website Needs a Support Contract

Almost nobody goes looking for a website support contract on a quiet Tuesday. They go looking after something has gone wrong, usually a site that’s been down since Saturday morning or a checkout that quietly stopped taking payments three days ago. By then you’re not choosing a support partner. You’re choosing whoever happens to pick …

isev Team

isev Team

22 September 2026

Hands typing on a laptop showing a messaging or admin screen
WordPress Security Checklist for UK Businesses (2026)

Your WordPress site went down last Tuesday at 2pm. You don’t know why, and neither does the person who built it three years ago. By the time it comes back, you’d missed four enquiries and your email had bounced for six hours. This happens to UK businesses every week. WordPress powers around 40% of all …

isev Team

isev Team

10 June 2026

Person using a laptop displaying sales charts and graphs
PPC in 2026: Why Your Business Should Consider Using Google Ads

Google Ads remains a powerful and constantly evolving solution. It's an great tool for businesses that want to be seen, stay competitive, and achieve tangible growth

isev Team

isev Team

6 June 2026

Woman standing in front of a video camera and studio light in an office
Do businesses need video marketing?

If you aren’t using video, you’re missing out on a target audience discovery and engagement channel. These days, social media platforms tend to push video far more than static posts, so it’s easy to get overlooked without it. The same goes for your website: most people would rather watch a quick video than scroll through …

isev Team

isev Team

29 April 2026