Piotr Sikora - Logo - Automatyzacja procesów | AI | JavaScript | Front End | Team Leader
  • Home
  • Services
    • Process Automation
    • AI for Lawyers
  • Blog
  • Quotes
  • Contact
PL/EN

Pure CSS Collapsible Elements: Create Accordion

  • Home
  • Blog
  • Pure CSS Collapsible Elements: Create Accordion
Pure CSS Collapsible Elements: Create Accordion

By Piotr Sikora

  • css

  • 1 min read

Pure CSS collapsible (with on click) containers / elements / whateva.

http://jsfiddle.net/u3Cjz

HTML Code:

<div id="elem"></div>

<a href="#" class="par cac1">Tab 1</a>
<a href="#" class="par cac2">Tab 2</a>
<a href="#" class="par cac3">Tab 3</a>

<h1 class="zzz1">ELEMENT 1</h1>
<h1 class="zzz2">ELEMENT 2</h1>
<h1 class="zzz3">ELEMENT 3</h1>

CSS Code:

h1 {display: none; }

a.par:focus {color: red}
a.par.cac1:focus ~ h1.zzz1 { display: block; color: blue }
a.par.cac2:focus ~ h1.zzz2 { display: block; color: blue }
a.par.cac3:focus ~ h1.zzz3 { display: block; color: blue }

Share this article

TwitterLinkedInFacebook

Tags:

  • #collapsible-without-javascript

  • #css

  • #html

Categories

after-hours(1)AI(7)ai-en(1)angular(4)automatic-tests(1)Automation(2)cryptography(1)css(8)CyberSecurity(2)Development(6)DevOps(1)events(3)javascript(11)n8n(10)ollama(1)security(2)seo(1)

Recent Posts

Testing Kimi Code: First Impressions from Web and CLI

Development

Testing Kimi Code: First Impressions from Web and CLI

Why You Shouldn't Cram Multiple Webhooks Into One n8n Workflow

Automation

Why You Shouldn't Cram Multiple Webhooks Into One n8n Workflow

DRY, WET, AHA: Finding the Right Balance in Code Reuse

Development

DRY, WET, AHA: Finding the Right Balance in Code Reuse

API vs Webhook: Understanding the Difference

Development

API vs Webhook: Understanding the Difference

RTCROS Framework: Structure Your Prompts for Better AI Results

AI

RTCROS Framework: Structure Your Prompts for Better AI Results

About Me

Piotr Sikora - Process Automation | AI | n8n | Python | JavaScript

Piotr Sikora

Process Automation Specialist

I implement automation that saves time and money, streamlines operations, and increases the predictability of results. Specializing in process automation, AI implementation, and workflow optimization using n8n, Python, and JavaScript.

n8n Workflows

n8n workflow automation templates

Explore my workflow templates on n8n. Ready-to-use automations for blog management, data collection, and AI-powered content processing.

3Workflow Templates
View Templates

• Auto-Categorize Blog Posts with AI

• Collect LinkedIn Profiles

• Export WordPress Posts for SEO

Tags

activepiecesafter-hoursahrefsaiAI cost reductionai-agentsai-automationangularantigravityapiAqua Securityarcade-gamesarchitectureautomationbackendbest-practicescadillacs-and-dinosaurschatbotchatgptCI/CD
“The man who follows the crowd will usually get no further than the crowd. The man who walks alone is likely to find himself in places no one has ever been.”
Anonymous
View more quotes

Similar Articles

Discover more related content

Master SASS Installation with This Quick Guide

Master SASS Installation with This Quick Guide

Ever dreamed of variables or functions in CSS? The easiest way to get them is by using a preprocessor like SASS.

3 April 2014
Front-End Developer Interview Questions Part 1

Front-End Developer Interview Questions Part 1

Essential CSS and HTML interview questions for front-end developers. Quick skill assessment guide for headhunters and candidates.

Professional CSS by Piotr Sikora

Professional CSS by Piotr Sikora

It's been a long time... I should tell about this book.

Piotr Sikora | ai | n8n | javascript | python

Let's get to know each other!

Get in touch with me
Piotr Sikora | Process Automation  | AI Implementation 🤖 | Technology Consulting
Quick links
  • Home
  • Blog
  • Contact
Contact
  • piotr.sikora.ck@gmail.com
  • +48 505 684 661

© Piotr Sikora 2026 | All Rights Reserved