Do you guys already use css @layer in your code? just curious.
Do you deem a level of adoption sufficient?

https://caniuse.com/mdn-css_at-rules_layer

all 4 comments

sorted by: hot top controversial new old
[–] 2 points 1 year ago

Why would I want to create an array called 'layer'?

  • source
  • [+] 2 points 1 year ago* (2 children)
  • [–] 4 points 1 year ago

    It's been a while, so I'm not sure about the details, but I had some elements on our website that I wanted to show when our extension was installed, and hide if not. I think I used layers, and then had the extension move the layer priority order. Was a clean way to fence off the extension-specific code.

  • source
  • parent
  • [–] [S] 1 point 1 year ago*

    I think it really helps if you dont like !important:

    @layer base, toggles;
    @layer toggles {
        .wprm-print-hide-recipe-nutrition .wprm-recipe-nutrition-label-section {
            display: none;
        }
    }
    
    

    instead of

    .wprm-print-hide-recipe-nutrition .wprm-recipe-nutrition-label-section {
        display: none !important;
    }
    

    I guess I answered my own question - I think its a neat feature and ill use it.

  • source
  • parent