Design comparison
SolutionDesign
Solution retrospective
For some reason my background wont come into the deploy it only works localhost cant figure out why. Feedback is welcome
Community feedback
- @markuslewinPosted 9 months ago
I think it's because in the build step, Vite will try to find the image after Tailwind has created the CSS rule inside
index.css
, so you want theurl()
insidetailwind.config.js
to be relative toindex.css
. It might also work to use an absolute path from the project root.// tailwind.config.js export default { theme: { extend: { backgroundImage: { "pattern-dark": "url('./assets/images/bg-mobile.svg')", "pattern-light": "url('./assets/images/bg-mobile-light.svg')", "pattern-dark-tablet": "url('./assets/images/bg-tablet.svg')", "pattern-light-tablet": "url('./assets/images/bg-tablet-light.png')", // or "pattern-dark": "url('/src/assets/images/bg-mobile.svg')", "pattern-light": "url('/src/assets/images/bg-mobile-light.svg')", "pattern-dark-tablet": "url('/src/assets/images/bg-tablet.svg')", "pattern-light-tablet": "url('/src/assets/images/bg-tablet-light.png')", }, }, }, };
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord