Horizontal Strip Tabs Accordion — Vertical Text Columns with flex-grow
The foundational horizontal accordion: collapsed columns show their titles rotated with writing-mode: vertical-rl; selecting a strip animates flex-grow so it expands sideways while siblings compress. Radio-driven (arrow-key navigable), with content that fades in only after the column has room.
Published Updated
The code
<section class="acc-15" aria-label="Horizontal strip tabs accordion demo">
<div class="acc-15__row" role="group" aria-label="Choose a studio location">
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-a" checked>
<label class="acc-15__face" for="acc-15-a"><span class="acc-15__strip">Copenhagen</span>
<span class="acc-15__content"><b>Copenhagen</b><i>HQ · est. 2019</i><p>Fourteen people over a bike shop in Nørrebro. Product, engineering and the espresso machine that started the company.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-b">
<label class="acc-15__face" for="acc-15-b"><span class="acc-15__strip">Toronto</span>
<span class="acc-15__content"><b>Toronto</b><i>Americas · est. 2022</i><p>Customer engineering and support, covering every timezone from UTC−8 to −3. The office dog is named Pixel.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-c">
<label class="acc-15__face" for="acc-15-c"><span class="acc-15__strip">Melbourne</span>
<span class="acc-15__content"><b>Melbourne</b><i>APAC · est. 2024</i><p>Our newest studio: three engineers, one designer, and the best coffee of the three offices — a contested claim.</p></span>
</label>
</div>
</div>
</section><section class="acc-15" aria-label="Horizontal strip tabs accordion demo">
<div class="acc-15__row" role="group" aria-label="Choose a studio location">
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-a" checked>
<label class="acc-15__face" for="acc-15-a"><span class="acc-15__strip">Copenhagen</span>
<span class="acc-15__content"><b>Copenhagen</b><i>HQ · est. 2019</i><p>Fourteen people over a bike shop in Nørrebro. Product, engineering and the espresso machine that started the company.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-b">
<label class="acc-15__face" for="acc-15-b"><span class="acc-15__strip">Toronto</span>
<span class="acc-15__content"><b>Toronto</b><i>Americas · est. 2022</i><p>Customer engineering and support, covering every timezone from UTC−8 to −3. The office dog is named Pixel.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-c">
<label class="acc-15__face" for="acc-15-c"><span class="acc-15__strip">Melbourne</span>
<span class="acc-15__content"><b>Melbourne</b><i>APAC · est. 2024</i><p>Our newest studio: three engineers, one designer, and the best coffee of the three offices — a contested claim.</p></span>
</label>
</div>
</div>
</section>.acc-15,
.acc-15 *,
.acc-15 *::before,
.acc-15 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-15 {
--accent: oklch(0.55 0.15 250);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef1f6;
padding: 44px 24px;
}
.acc-15__row {
display: flex;
gap: 10px;
width: min(720px,100%);
height: 380px;
}
.acc-15__panel {
display: flex;
flex-grow: 1;
flex-basis: 0;
min-width: 64px;
transition: flex-grow .5s cubic-bezier(.4,0,.2,1);
}
.acc-15__panel:has(input:checked) {
flex-grow: 6;
}
.acc-15__panel input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
.acc-15__face {
position: relative;
flex: 1;
display: block;
background: #fff;
border: 1.5px solid #dde2ec;
border-radius: 16px;
cursor: pointer;
overflow: hidden;
transition: border-color .3s,background .3s;
}
.acc-15__panel:has(input:checked) .acc-15__face {
border-color: var(--accent);
background: #fff;
}
.acc-15__face:hover {
border-color: #b9c3d8;
}
.acc-15__strip {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
writing-mode: vertical-rl;
font-size: 15px;
font-weight: 700;
letter-spacing: .12em;
text-transform: uppercase;
color: #8a93ab;
transition: opacity .25s;
padding: 18px 0;
}
.acc-15__panel:has(input:checked) .acc-15__strip {
opacity: 0;
}
.acc-15__content {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 6px;
padding: 26px;
opacity: 0;
transition: opacity .3s .18s;
}
.acc-15__panel:has(input:checked) .acc-15__content {
opacity: 1;
}
.acc-15__content b {
font-size: 24px;
font-weight: 800;
color: #1b2338;
letter-spacing: -.02em;
}
.acc-15__content i {
font-style: normal;
font-size: 12px;
font-weight: 700;
letter-spacing: .13em;
text-transform: uppercase;
color: var(--accent);
}
.acc-15__content p {
font-size: 14px;
line-height: 1.6;
color: #4c5674;
max-width: 38ch;
}
.acc-15__panel:has(input:focus-visible) .acc-15__face {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
@media (max-width: 560px) {
.acc-15__row {
flex-direction: column;
height: auto;
}
.acc-15__panel {
min-height: 64px;
}
.acc-15__panel:has(input:checked) {
min-height: 240px;
}
.acc-15__strip {
writing-mode: horizontal-tb;
justify-content: flex-start;
padding: 0 22px;
}
}
@media (prefers-reduced-motion: reduce) {
.acc-15__panel,
.acc-15__strip,
.acc-15__content {
transition: none;
}
}.acc-15,
.acc-15 *,
.acc-15 *::before,
.acc-15 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-15 {
--accent: oklch(0.55 0.15 250);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef1f6;
padding: 44px 24px;
}
.acc-15__row {
display: flex;
gap: 10px;
width: min(720px,100%);
height: 380px;
}
.acc-15__panel {
display: flex;
flex-grow: 1;
flex-basis: 0;
min-width: 64px;
transition: flex-grow .5s cubic-bezier(.4,0,.2,1);
}
.acc-15__panel:has(input:checked) {
flex-grow: 6;
}
.acc-15__panel input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
.acc-15__face {
position: relative;
flex: 1;
display: block;
background: #fff;
border: 1.5px solid #dde2ec;
border-radius: 16px;
cursor: pointer;
overflow: hidden;
transition: border-color .3s,background .3s;
}
.acc-15__panel:has(input:checked) .acc-15__face {
border-color: var(--accent);
background: #fff;
}
.acc-15__face:hover {
border-color: #b9c3d8;
}
.acc-15__strip {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
writing-mode: vertical-rl;
font-size: 15px;
font-weight: 700;
letter-spacing: .12em;
text-transform: uppercase;
color: #8a93ab;
transition: opacity .25s;
padding: 18px 0;
}
.acc-15__panel:has(input:checked) .acc-15__strip {
opacity: 0;
}
.acc-15__content {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 6px;
padding: 26px;
opacity: 0;
transition: opacity .3s .18s;
}
.acc-15__panel:has(input:checked) .acc-15__content {
opacity: 1;
}
.acc-15__content b {
font-size: 24px;
font-weight: 800;
color: #1b2338;
letter-spacing: -.02em;
}
.acc-15__content i {
font-style: normal;
font-size: 12px;
font-weight: 700;
letter-spacing: .13em;
text-transform: uppercase;
color: var(--accent);
}
.acc-15__content p {
font-size: 14px;
line-height: 1.6;
color: #4c5674;
max-width: 38ch;
}
.acc-15__panel:has(input:focus-visible) .acc-15__face {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
@media (max-width: 560px) {
.acc-15__row {
flex-direction: column;
height: auto;
}
.acc-15__panel {
min-height: 64px;
}
.acc-15__panel:has(input:checked) {
min-height: 240px;
}
.acc-15__strip {
writing-mode: horizontal-tb;
justify-content: flex-start;
padding: 0 22px;
}
}
@media (prefers-reduced-motion: reduce) {
.acc-15__panel,
.acc-15__strip,
.acc-15__content {
transition: none;
}
}/* No JavaScript — hidden radios drive :has(input:checked) panel expansion via a flex-grow transition; arrow keys navigate the radio group natively, and content opacity is delayed until the column has width. */
/* No JavaScript — hidden radios drive :has(input:checked) panel expansion via a flex-grow transition; arrow keys navigate the radio group natively, and content opacity is delayed until the column has width. */Here's a working CSS Accordions — Vertical & Horizontal from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Horizontal Strip Tabs Accordion — Vertical Text Columns with flex-grow
Source: https://codefronts.com/navigation/css-accordions/strip-tabs/
The foundational horizontal accordion: collapsed columns show their titles rotated with writing-mode: vertical-rl; selecting a strip animates flex-grow so it expands sideways while siblings compress. Radio-driven (arrow-key navigable), with content that fades in only after the column has room.
## HTML
```html
<section class="acc-15" aria-label="Horizontal strip tabs accordion demo">
<div class="acc-15__row" role="group" aria-label="Choose a studio location">
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-a" checked>
<label class="acc-15__face" for="acc-15-a"><span class="acc-15__strip">Copenhagen</span>
<span class="acc-15__content"><b>Copenhagen</b><i>HQ · est. 2019</i><p>Fourteen people over a bike shop in Nørrebro. Product, engineering and the espresso machine that started the company.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-b">
<label class="acc-15__face" for="acc-15-b"><span class="acc-15__strip">Toronto</span>
<span class="acc-15__content"><b>Toronto</b><i>Americas · est. 2022</i><p>Customer engineering and support, covering every timezone from UTC−8 to −3. The office dog is named Pixel.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-c">
<label class="acc-15__face" for="acc-15-c"><span class="acc-15__strip">Melbourne</span>
<span class="acc-15__content"><b>Melbourne</b><i>APAC · est. 2024</i><p>Our newest studio: three engineers, one designer, and the best coffee of the three offices — a contested claim.</p></span>
</label>
</div>
</div>
</section>
```
## CSS
```css
.acc-15,
.acc-15 *,
.acc-15 *::before,
.acc-15 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-15 {
--accent: oklch(0.55 0.15 250);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef1f6;
padding: 44px 24px;
}
.acc-15__row {
display: flex;
gap: 10px;
width: min(720px,100%);
height: 380px;
}
.acc-15__panel {
display: flex;
flex-grow: 1;
flex-basis: 0;
min-width: 64px;
transition: flex-grow .5s cubic-bezier(.4,0,.2,1);
}
.acc-15__panel:has(input:checked) {
flex-grow: 6;
}
.acc-15__panel input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
.acc-15__face {
position: relative;
flex: 1;
display: block;
background: #fff;
border: 1.5px solid #dde2ec;
border-radius: 16px;
cursor: pointer;
overflow: hidden;
transition: border-color .3s,background .3s;
}
.acc-15__panel:has(input:checked) .acc-15__face {
border-color: var(--accent);
background: #fff;
}
.acc-15__face:hover {
border-color: #b9c3d8;
}
.acc-15__strip {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
writing-mode: vertical-rl;
font-size: 15px;
font-weight: 700;
letter-spacing: .12em;
text-transform: uppercase;
color: #8a93ab;
transition: opacity .25s;
padding: 18px 0;
}
.acc-15__panel:has(input:checked) .acc-15__strip {
opacity: 0;
}
.acc-15__content {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 6px;
padding: 26px;
opacity: 0;
transition: opacity .3s .18s;
}
.acc-15__panel:has(input:checked) .acc-15__content {
opacity: 1;
}
.acc-15__content b {
font-size: 24px;
font-weight: 800;
color: #1b2338;
letter-spacing: -.02em;
}
.acc-15__content i {
font-style: normal;
font-size: 12px;
font-weight: 700;
letter-spacing: .13em;
text-transform: uppercase;
color: var(--accent);
}
.acc-15__content p {
font-size: 14px;
line-height: 1.6;
color: #4c5674;
max-width: 38ch;
}
.acc-15__panel:has(input:focus-visible) .acc-15__face {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
@media (max-width: 560px) {
.acc-15__row {
flex-direction: column;
height: auto;
}
.acc-15__panel {
min-height: 64px;
}
.acc-15__panel:has(input:checked) {
min-height: 240px;
}
.acc-15__strip {
writing-mode: horizontal-tb;
justify-content: flex-start;
padding: 0 22px;
}
}
@media (prefers-reduced-motion: reduce) {
.acc-15__panel,
.acc-15__strip,
.acc-15__content {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — hidden radios drive :has(input:checked) panel expansion via a flex-grow transition; arrow keys navigate the radio group natively, and content opacity is delayed until the column has width. */
```Here's a working CSS Accordions — Vertical & Horizontal from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Horizontal Strip Tabs Accordion — Vertical Text Columns with flex-grow
Source: https://codefronts.com/navigation/css-accordions/strip-tabs/
The foundational horizontal accordion: collapsed columns show their titles rotated with writing-mode: vertical-rl; selecting a strip animates flex-grow so it expands sideways while siblings compress. Radio-driven (arrow-key navigable), with content that fades in only after the column has room.
## HTML
```html
<section class="acc-15" aria-label="Horizontal strip tabs accordion demo">
<div class="acc-15__row" role="group" aria-label="Choose a studio location">
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-a" checked>
<label class="acc-15__face" for="acc-15-a"><span class="acc-15__strip">Copenhagen</span>
<span class="acc-15__content"><b>Copenhagen</b><i>HQ · est. 2019</i><p>Fourteen people over a bike shop in Nørrebro. Product, engineering and the espresso machine that started the company.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-b">
<label class="acc-15__face" for="acc-15-b"><span class="acc-15__strip">Toronto</span>
<span class="acc-15__content"><b>Toronto</b><i>Americas · est. 2022</i><p>Customer engineering and support, covering every timezone from UTC−8 to −3. The office dog is named Pixel.</p></span>
</label>
</div>
<div class="acc-15__panel">
<input type="radio" name="acc-15" id="acc-15-c">
<label class="acc-15__face" for="acc-15-c"><span class="acc-15__strip">Melbourne</span>
<span class="acc-15__content"><b>Melbourne</b><i>APAC · est. 2024</i><p>Our newest studio: three engineers, one designer, and the best coffee of the three offices — a contested claim.</p></span>
</label>
</div>
</div>
</section>
```
## CSS
```css
.acc-15,
.acc-15 *,
.acc-15 *::before,
.acc-15 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-15 {
--accent: oklch(0.55 0.15 250);
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef1f6;
padding: 44px 24px;
}
.acc-15__row {
display: flex;
gap: 10px;
width: min(720px,100%);
height: 380px;
}
.acc-15__panel {
display: flex;
flex-grow: 1;
flex-basis: 0;
min-width: 64px;
transition: flex-grow .5s cubic-bezier(.4,0,.2,1);
}
.acc-15__panel:has(input:checked) {
flex-grow: 6;
}
.acc-15__panel input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip-path: inset(50%);
}
.acc-15__face {
position: relative;
flex: 1;
display: block;
background: #fff;
border: 1.5px solid #dde2ec;
border-radius: 16px;
cursor: pointer;
overflow: hidden;
transition: border-color .3s,background .3s;
}
.acc-15__panel:has(input:checked) .acc-15__face {
border-color: var(--accent);
background: #fff;
}
.acc-15__face:hover {
border-color: #b9c3d8;
}
.acc-15__strip {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
writing-mode: vertical-rl;
font-size: 15px;
font-weight: 700;
letter-spacing: .12em;
text-transform: uppercase;
color: #8a93ab;
transition: opacity .25s;
padding: 18px 0;
}
.acc-15__panel:has(input:checked) .acc-15__strip {
opacity: 0;
}
.acc-15__content {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
justify-content: flex-end;
gap: 6px;
padding: 26px;
opacity: 0;
transition: opacity .3s .18s;
}
.acc-15__panel:has(input:checked) .acc-15__content {
opacity: 1;
}
.acc-15__content b {
font-size: 24px;
font-weight: 800;
color: #1b2338;
letter-spacing: -.02em;
}
.acc-15__content i {
font-style: normal;
font-size: 12px;
font-weight: 700;
letter-spacing: .13em;
text-transform: uppercase;
color: var(--accent);
}
.acc-15__content p {
font-size: 14px;
line-height: 1.6;
color: #4c5674;
max-width: 38ch;
}
.acc-15__panel:has(input:focus-visible) .acc-15__face {
outline: 3px solid var(--accent);
outline-offset: 3px;
}
@media (max-width: 560px) {
.acc-15__row {
flex-direction: column;
height: auto;
}
.acc-15__panel {
min-height: 64px;
}
.acc-15__panel:has(input:checked) {
min-height: 240px;
}
.acc-15__strip {
writing-mode: horizontal-tb;
justify-content: flex-start;
padding: 0 22px;
}
}
@media (prefers-reduced-motion: reduce) {
.acc-15__panel,
.acc-15__strip,
.acc-15__content {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — hidden radios drive :has(input:checked) panel expansion via a flex-grow transition; arrow keys navigate the radio group natively, and content opacity is delayed until the column has width. */
```How this works
The container is a fixed-height flex row. Each panel holds a visually-hidden <input type=radio> + a full-size <label>; all radios share one name, so exactly one panel is active and — because they're real radios — Left/Right arrow keys move the selection natively once focused. The expansion is a flex-grow transition: collapsed panels sit at flex-grow:1, the :checked one at flex-grow:6 — the browser interpolates the growth, producing a smooth sideways slide with zero width math.
Collapsed titles read vertically via writing-mode: vertical-rl. The trick that makes horizontal accordions feel professional: content opacity is DELAYED (transition: opacity .3s .15s) so text appears only after the column has widened — revealing text into a too-narrow column is the telltale amateur glitch.
Techniques used: flex-grow number transition (the entire layout animation) · radio group semantics = native arrow-key navigation · writing-mode: vertical-rl collapsed titles · delayed content fade (opacity transition-delay) · :has(:focus-visible) panel focus ring
Make it yours
- Expansion ratio = the checked flex-grow value (6 here).
- Container height is one value on the row.
- Vertical title direction: vertical-lr flips the reading direction.
- Start panel = whichever input has
checked.
Gotchas — read before shipping
- Radios mean ONE panel is always open — a horizontal accordion with all panels collapsed has no obvious affordance, so this is the right constraint, not a limitation.
- Delay content opacity ~150ms behind the width change or text visibly reflows in a skinny column mid-animation.
- Radio semantics announce as a radio group, not a disclosure — honest and operable; add aria-label on the group container naming the widget ('Choose a location').
- On narrow screens flip the whole thing to a normal vertical stack via media query (done at 560px) — horizontal accordions need width to breathe.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 15.4+ | 121+ | 111+ |
Floor set by :has(), oklch() as this demo is written. The core technique itself goes back further — Chrome all.
flex-grow transitions and writing-mode are baseline everywhere — this is the most portable horizontal accordion recipe.