'Target mobile only breakpoint

I'm using Tailwind v3.

I have a custom background color being applied in an inline style with javascript:

<div style="background-color: RANDOM_GENERATED_COLOR" />

However in mobile breakpoint, I want it to ignore this background color, I want no background. So what I did was add !bg-transparent, using the "!" modifier I make it override the inline style:

<div style="background-color: RANDOM_GENERATED_COLOR" class="!bg-transparent" />

However I don't want the inline style overriden at all other breakpoints sm and above.

Is it possible to target !bg-transparent to mobile only breakpoint?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source