🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsHeader and Footer not showing in Excel(14.09.2026 um 22:43 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsKB5129194 Windows 11 26H1 Out of Band Update - Deskmodder.de(14.09.2026 um 19:25 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsHeader and Footer not showing in Excel(14.09.2026 um 22:43 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsKB5129194 Windows 11 26H1 Out of Band Update - Deskmodder.de(14.09.2026 um 19:25 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 2 Min Lesezeit
0

CSS: Decoupling Behaviors

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

A press effect, shadow on rest, lifted on hover, depressed on active, is not central to buttons. It can be used on cards, image gallery photos, and other elements. The same goes for animations and other behaviors. This leaves me to question "why aren't they decoupled from the component?



In my own code I create with a dedicated behaviors layer. Each interaction pattern is its own class, independent of any component. You can even stack multiple behaviors together.



Let's create a simple one that adds more click affordance.






Press Example



Adding b-press gives any flat element a physical depth through shadow states. It lifts on hover and depresses on active, giving users a clear sense that something is clickable. Disabled elements will lose the shadow entirely so the affordance disappears with the interaction.



CSS




CODE
@layer behaviors {
.b-press {
box-shadow:
var(--wisp-shadow,
0 1px 2px rgba(0, 0, 0, 0.10),
0 1px 3px rgba(0, 0, 0, 0.06)
);
cursor: pointer;
}

.b-press:hover {
box-shadow:
var(--wisp-shadow-hover,
0 4px 6px rgba(0, 0, 0, 0.12),
0 2px 4px rgba(0, 0, 0, 0.10)
);
}

.b-press:active {
box-shadow:
var(--wisp-shadow-active,
0 1px 2px rgba(0, 0, 0, 0.16),
0 1px 1px rgba(0, 0, 0, 0.12)
);
transform: translateY(1px);
}

.b-press:disabled,
.b-press[aria-disabled="true"] {
box-shadow: 0 0 0 rgba(0, 0, 0, 0);
cursor: not-allowed;
}
}




HTML





CODE
<div class="o-card b-press">

...

</div>











Finally



When we think of OOCSS we think of visual repeating patterns, but behaviors are patterns too and deserve the same love that objects and components get.



You can find the decoupled behaviors in my framework source here:



https://github.com/wispcode/wisp-css/tree/main/src/behaviors

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
The Gemini desktop app is now available for Windows
1 Quelle
Header and Footer not showing in Excel
1 Quelle
Burn Out, Or Fade Away
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten CSS: Decoupling Behaviors

Thematisch verwandte Begriffe: Decoupling, Behaviors · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...