Tools51

CSS & UI STUDIO GUIDE

How to build pure-CSS tabs and iOS segmented controls using CSS :has()

Switch active tabs and content panels in pure CSS with native keyboard support.

Design zero-JavaScript underline tabs, recessed iOS segmented pills, boxed folder tabs, and vertical tab panels powered by CSS :has(input:checked).

Follow the guide
Before Exposed Radio Buttons
CSS Tabs & Segmented Control Generator unstyled HTML before — Exposed Radio Buttons
Plain browser radio inputs requiring custom JS listeners to toggle panels.
After Zero-JS :has() Segmented Tabs
CSS Tabs & Segmented Control Generator styled CSS result after — Zero-JS :has() Segmented Tabs
Tactile segmented pill or underline tabs switching content panels via CSS :has().
QUICK VIDEO TUTORIAL How to build pure-CSS tabs and iOS segmented controls using CSS :has() Switch active tabs and content panels in pure CSS with native keyboard support. Watch the video

How to build pure-CSS tabs and iOS segmented controls using CSS :has()

01

Choose a tab navigation architecture

Open CSS Tabs & Segmented Control Generator and explore iOS Segmented Recessed Pills, Crisp SaaS Underline Bars, Solid & Soft Pill Tabs, Boxed Folder Cards, and Vertical Sidebar Rails.

Click Overview, Analytics, and Settings right inside any preset to watch panels switch live.

02

Refine colors, padding, and content panels

Toggle Include content panel off if you only need a compact segmented toolbar control, or keep it on for full multi-panel switching.

Adjust Corner radius (from sharp 0px underlines to 999px capsules), horizontal/vertical padding, and active accent.

Unique radio group names per widget

Always give each tab component on the same page a distinct name="..." attribute on its radio inputs so two tab bars remain independent.

Inset inner pill radius math

On segmented tracks, setting innerRadius = outerRadius - padding (12px - 4px = 8px) keeps corners optically concentric!

03

Copy production CSS and HTML

Visually hidden <input type="radio"> elements preserve native Left/Right arrow-key cycling and :has(input:focus-visible) focus rings.

Export Vanilla CSS, HTML, :root tokens, or Tailwind markup.

Ready to use CSS Tabs & Segmented Control Generator?

Open CSS Tabs & Segmented Control Generator in your browser—100% private on your device with zero sign-up and copy-ready CSS, HTML, :root tokens, and Tailwind code. Related CSS studios: CSS Accordion & FAQ Generator, CSS Button Generator, CSS Checkbox & Toggle Generator.

Open CSS Tabs & Segmented Control Generator
Common questions

CSS Tabs & Segmented Control Generator FAQs

Practical frontend details for accessible, cross-browser CSS output.

Which browsers support CSS :has() for pure-CSS tabs?

All evergreen versions of Chrome, Edge, Safari, and Firefox support :has() natively.

How are the radio buttons hidden without breaking keyboard focus?

Using position: absolute; opacity: 0; pointer-events: none; keeps inputs focusable via keyboard while hiding the default circle.

Can I add a fourth or fifth tab?

Yes—duplicate a <label class="ui-tabs__tab"> with data-tab="4" and add .ui-tabs:has([data-tab="4"]:checked) [data-panel="4"] { display: block; }.

Image detail

Language38

EnglishالعربيةFrançaisItalianoDeutschEspañolPortuguêsNederlandsРусскийTürkçe日本語中文हिन्दीBahasa IndonesiaBahasa Melayu한국어Tiếng ViệtไทยPolskiSvenskaУкраїнськаNorskবাংলাΕλληνικάفارسیاردوČeštinaDanskMagyarRomânăSuomiБългарскиFilipinoქართულიSlovenčinaAzərbaycancaעבריתSlovenščina