Design comparison
Solution retrospective
What did you find difficult while building the project? Getting the quote SVG to appear behind the text of the first testimonial card.
Which areas of your code are you unsure of? I don't know how to add the quote SVG behind the text of the first testimonial card:
- If I add it as an image, it works like a block element and stacks on top.
- If I add it as a background-image to the containing element, it doesn't appear. ¯_(ツ)_/¯
Do you have any questions about best practices? How do you put SVGs in part of a background of a containing element behind other elements?
Community feedback
- @vanzasetiaPosted over 1 year ago
Hi there!
I recommend making the quote SVG as a background image of the testimonial card. Then, position it with
background-position
property.I think the background image does not show because you did:
#featured { background-image: url(./images/bg-pattern-quotation.svg); background-repeat: no-repeat; background-position: top right; background: var(--moderate-violet); position: relative; z-index: 0; }
The
background
shorthand property will overwrite the previous background properties. Be aware of shorthand property.The problem with shorthands in CSS - YouTube | Kevin Powell
To make the background image shows up, you need to change the
background
tobackground-color
—or put the previous three background properties below thebackground
property.I hope this helps. Happy coding! 👍
Marked as helpful0 - @0xabdulkhaliqPosted over 1 year ago
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
SUGGESTION 💡
- During inspecting your code i found that you overused the
absolute
positioning formain
element. Because the you already centered themain
withgrid
layout and you still usingabsolute
which serves no purpose in this case.
- As developers we want to reduce our lines of code be refractoring it, without writing efficient codes we can't become a better developer. So kindly remove these style rules from your
css
file for optimizing youcss
file
.container { margin: 0; position: absolute; top: 50%; left: 50%; -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 100%; }
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful0 - @myles-portfolioPosted over 1 year ago
Removing the .container class from <main> seemed to enable the absolute position of the .quote-icon img to not break when responsive. :)
I would still like to know how to put SVGs as background-images. For some reason, they never appear in the viewport when I add them that way. My plan is to play around with them in Codepen.io to figure out how they behave.
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