✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

How to Override a CSS Class Style

3 replies
Last updated: Apr 15, 2022
hi, what is the best way to override a CSS class’ style. I saw this documentation , but it didn’t work as I had hoped.
For example, I added the following class override in ./variableOverrides.css to CSS hide an element, but when I use the browser’s developer tool to inspect the element, my custom style doesn’t appear to be loaded. I re-started by local Sanity Studio server to be safe as well.


.IkYbE {
  display: none !important;
}
Apr 15, 2022, 10:27 PM
Can you try adding a
:global()
to your selector? Example here .
Apr 15, 2022, 10:34 PM
That worked perfectly
user M
! Thanks for the speedy reply
Apr 15, 2022, 10:54 PM
You're welcome!
Apr 15, 2022, 10:56 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?