Get a peek at our latest innovations at Sanity Product Day on Dec 8th →

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.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Free to get started, and pay-as-you-go on all plans. Find out more.