Theo Soti (@theoleff) header
Theo Soti (@theoleff) profile picture

Author of the book "You don't need JavaScript". If you want all my tips and tricks about CSS, check my blog https://teapawt.net/t.co/bm4SG4Q2mK

Paris, Île-de-France
Joined January 2012
Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)Photo by Theo Soti (@theoleff)
Animating an accordion open was impossible for years. The panel goes from 0 to auto, and auto is a keyword, not a number. :root { interpolate-size: allow-keywords; } That line makes auto animatable. Chromium only in 2026. Sound on.
1
30
Search for a word inside a closed <details> and the browser opens that section and scrolls to it. Text in a closed panel is still real text, so find in page reaches it. Screen readers announce expanded and collapsed with no ARIA from you. Sound on.
2
72
One HTML attribute turns separate details elements into an exclusive accordion. <details name="faq">...</details> Open one and the browser closes the previous panel. Sound on.
1
37
Most accordions do not need a click handler. <details> <summary>Question</summary> <p>Answer</p> </details> The browser handles state, keyboard input and accessibility. Sound on.
2
43
Want to know if your website could replace part of its code with modern HTML & CSS? I built a small audit tools that does just that: cssradar.com/ it was even featured on @syntaxfm !!
2
29
One p { color: blue } and your sidebar goes blue too. @scope draws a boundary that specificity never could. Sound on.
4
58
Let the reader choose grid or list. Two labelled radios and :has(). No JavaScript. Sound on.
2
39
You can stop writing .card at the front of every rule. Native CSS nesting, no build step. Sound on.
2
31
Text that wraps around the curve of an image, not its bounding box. shape-outside reads the transparent edge, shape-margin keeps the letters off it. Sound on.
2
61
Infinite logo marquee, no JavaScript timer. One shared animation, and a negative animation-delay starts each logo mid-cycle so the track is full on frame one. Sound on.
5
183
:focus fires on click and on Tab. :focus-visible only when the browser decides a ring is needed. Mouse users get no ring, keyboard users always do. Sound on.
5
109
Cross-fade between two pages of your site. No router, no script. @view-transition { navigation: auto; } Add the rule to both pages, keep your ordinary links. The browser snapshots the old view and blends it into the new one. Sound on.
2
54
Same card in the main column and in a narrow sidebar. A media query sees one width for both. .wrapper { container-type: inline-size; } @container (min-width: 30rem) { .card { grid-template-columns: 1fr 1fr; } } Ask the container, not the screen. Sound on.
3
45
Anchor link scrolls to the heading and your fixed header covers it. html { scroll-behavior: smooth; scroll-padding-top: 5rem; } scroll-behavior softens the travel. scroll-padding-top is what actually clears the header. Sound on.
1
39
An animated gradient border on a card, no wrapper element. border: 3px solid transparent; background: #111 padding-box, conic-gradient(from var(--angle), #f0f, #0ff, #f0f) border-box; Register --angle as <angle>, animate it, the gradient spins. No wrapper. No JS. Sound on.
1
6
381
calc(auto + 2rem) is invalid. calc() will not add to auto. calc-size(auto, size + 2rem) does. height: calc-size(auto, size + 2rem); First arg sets the basis (auto). Second uses "size" as a variable holding the resolved height. Add whatever math you need. Sound on.
2
59
Inputs that grow with the value you type. Native CSS, no resize scripts. input, select, textarea { field-sizing: content; min-inline-size: 5ch; max-inline-size: 40ch; } Placeholder sets the starting size. The value takes over from there. Sound on.
2
81
!important everywhere means you already lost the specificity war. @layer reset, base, components, utilities; Later layer wins, whatever the specificity. Drop your rules into the right layer and the cascade behaves. Sound on.
1
28
Your underlines don't have to look like default underlines. a { text-decoration: underline wavy deeppink; text-decoration-thickness: 5px; text-underline-offset: 4px; text-decoration-skip-ink: auto; } Custom color, style, thickness, and offset. All native. Sound on.
1
73
A live count of checked boxes, in pure CSS. body { counter-reset: n; } input:checked { counter-increment: n; } .total::after { content: counter(n); } No script. No state. Just the cascade doing math. Sound on.
2
37