Design comparison
Solution retrospective
Hello, I need help again with background-image: URL()
this one works on my computer background-image: url(/assets/img/bg-pattern-quotation.svg);
previously I was told to try these and worked on the previous challenge but not on this one background-image: url(/Testimonials/assets/img/bg-pattern-top.svg); background-image: url(../img/bg-pattern-top.svg);
I also tried this but it didn't work either background-image: url('./assets/img/bg-pattern-quotation.svg');
Community feedback
- @huyphan2210Posted 3 days ago
Hi @cgeguizabal,
I’d like to help with your background image issue. While I’m not completely sure of the specifics of your situation, here are a few possible explanations that might help:
- The visibility and size of a background-image are heavily influenced by its container. If the container lacks dimensions, the image won’t be visible. For example, if you’re applying a background-image to a <div> that has no content and no assigned width or height, the background image won’t show. Example:
.background-div { background-image: url('example.jpg'); background-size: cover; /* Ensure the image scales properly */ background-position: center; /* No width or height */ }
To fix this, ensure the container has defined dimensions:
.background-div { width: 100%; /* Or any specific width */ height: 300px; /* Or any specific height */ background-image: url('example.jpg'); background-size: cover; background-position: center; }
It seems like you’ve resolved the issue, but considering the point above might help you avoid similar problems in the future.
Hope this helps!
Marked as helpful0@cgeguizabalPosted 3 days ago@huyphan2210 thank you so much I will take into consideration your explanation, I'm a beginner so everything is helpful. I didn't quite resolve it, I uploaded it to another host(netlify) so I'm still going to try applying your advice on github page.
0 - @AhirgautamPosted 4 days ago
writing this will do the job :- url(/Testimonials/assets/img/bg-pattern-quotation.svg)
Marked as helpful0@cgeguizabalPosted 3 days ago@Ahirgautam Thanks a lot, I will try it out right now.
0
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