emGee Software Solutions Custom Database Applications

Share this

Web Technologies

Global CSS options with custom properties

CSS-Tricks - Fri, 05/29/2020 - 15:26

With a preprocessor, like Sass, building a logical “do this or don’t” setting is fairly straightforward:

$option: false; @mixin doThing { @if $option { do-thing: yep; } } .el { @include doThing; }

Can we do that in native CSS with custom properties? Mark Otto shows that we can. It’s just a smidge different.

html { --component-shadow: 0 .5rem 1rem rgba(0,0,0,.1); } .component { box-shadow: var(--component-shadow); } <!-- override the global anywhere more specific! like <div class="component remove-shadow"> or <body class="remove-shadow"> --> .remove-shadow { --component-shadow: none; }

Direct Link to ArticlePermalink

The post Global CSS options with custom properties appeared first on CSS-Tricks.

Categories: Web Technologies

Angular + Nest.js

Echo JS - Fri, 05/29/2020 - 10:55
Categories: Web Technologies

Motionia - JS animation library

Echo JS - Fri, 05/29/2020 - 10:55
Categories: Web Technologies

Smarter Redux with Redux Toolkit

Echo JS - Fri, 05/29/2020 - 10:55
Categories: Web Technologies

Pages

1 2 3 4 5 6 7 8 9 next › last »