CSS tip: CSS has if() now.
.badge {
background: if(
style(--status: online): #16A34A;
style(--status: away): #F59E0B;
else: #9CA3AF
);
}
Set --status on the element and the color follows.
CSS tip: CSS has if() now. .badge { background: if( style(--status: online): #16A34A; style(--status: away): #F59E0B; else: #9CA3AF ); } Set --status on the element and the color follows.
0 vue
Publié le 26/11/2026 11:52
CSS tip: CSS has if() now.
.badge {
background: if(
style(--status: online): #16A34A;
style(--status: away): #F59E0B;
else: #9CA3AF
);
}
Set --status on the element and the color follows.
0 commentaire
?