Design comparison
Solution retrospective
I'm most proud of successfully integrating SVG backgrounds into the design, learning how to manage their positioning while keeping the card and other elements layered correctly. Additionally, I’m happy with how the responsive layout turned out, ensuring the design works well across different screen sizes.
What challenges did you encounter, and how did you overcome them?Initially, I had challenges with the SVG background and not having it affect the card div storing the rest of the content. To fix this problem, I utilized position:absolute and made the z-index 0 so it doesn't impact the normal flow of the document.
What specific areas of your project would you like help with?If you notice the svg element inside of the card container, the image is not in the correct position where its supposed to be and i didnt know how to fix this and tried various things that correspond with its size and position in the container.
svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
/* card would be on top as the svg is in the background */
}
.hero {
position: relative;
z-index: 1;
border-radius: 20px 20px 0 0;
width: 100%;
height: 220px;
object-position: center;
object-fit: contain;
}
As you can see this is a small error that needs to be fixed and would love all feedback for this design!
Community feedback
- @Wannika123Posted about 1 month ago
Hi, how you use absolute position for the background is totally fine and it works. But there's a property called
background-image
, which is probably more convenient in a case like this.It's just like
background-color
but for the image. You can use it like this:body { background-image: url(./images/pattern-background-desktop.svg); }
The default behavior is that the image will repeat to fill all the space in the background, so in this case you also have to set
background-repeat: no-repeat
.Marked as helpful0 - @ClipzoramaPosted about 1 month ago
After submitting the solution, I noticed that the intended size of the container differs from mine. This discrepancy might be influencing the positioning of the SVG element, preventing it from aligning correctly within the container as shown in the design.
What do you guys think? Please let me know so I can use this feedback in future projects. Thank you :)
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