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 }

Categories

Recent Posts

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

• Auto-Categorize Blog Posts with AI

• Collect LinkedIn Profiles

• Export WordPress Posts for SEO

Similar Articles

Discover more related content

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.

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

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