Design comparison
Solution retrospective
I'm not sure that I went up setting the background svgs the right way. You can tell because I didn't really refactor my code from trying a couple of options so the bem naming might not make sense.
I first tried to use the both as backgrounds using pure css. I ended up making separate divs and using some absolute and relative positioning with some transformations.
Any feedback is useful! Thanks!
Community feedback
- Account deleted
Using an img tag for decorative items works, just make sure you include an empty alt tag.
<img src="file-url.svg" alt="">
Without an alt tag, screen readers will read the src url to the user. Another way you can do it for example => (::before works as well)
item::after { content: ' '; height: 100px; width: 50px; background: url('relative-file-path.svg') no-repeat; background-size: 100%; background-position: bottom left; position: absolute; }
It's a bit more finicky that way as you have to explicitly set the height and width, but is sometimes useful in keeping your HTML clean.
Marked as helpful0
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