Skip to content

Gatsby StaticImage does not respect TailwindCSS responsive modifiers in the production build. #33565

Answered by LekoArts
kaushalyap asked this question in Help
Discussion options

You must be logged in to vote

This happens due to CSS specificity. The style for .gatsby-image-wrapper-constrained is for performance reasons in a <style> tag in the <head> and thus has a higher specificity than the CSS from another file (Tailwind). So it overwrites Tailwind for the display property.

Use !important and it'll work.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@wardpeet
Comment options

@kaushalyap
Comment options

@wardpeet
Comment options

@hisnameisjimmy
Comment options

@hisnameisjimmy
Comment options

Answer selected by kaushalyap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #33564 on October 18, 2021 07:47.