How to place this svg as my background footer with Tailwind?
Guys i dont know how to do this. I want my footer exactly like this but i have it fixed on the screen. So if i scroll up it follows me.
Here is the Footer component where i think only the "relative z-50 bg-footer" classes are relevant:
Here is the bg-footer class i'm building:
if i change it to absolute it just disappears.
I tried to follow this from css-tricks but i failed miserably https://css-tricks.com/lodge/svg/06-using-svg-svg-background-image/
Chris Coyier
CSS-Tricks
06: Using SVG - SVG as background-image | CSS-Tricks
SVG images can be used as background-image in CSS as well, just like PNG, JPG, or GIF.
5 Replies
If anyone can give me a different approach or examples from other sites i'd appreciate it
When you don't have it with position absolute, what's the problem?
Like, what isn't working right now? Do you have an example anywhere so we could see it?
I'm not sure if you can upload images, but https://play.tailwindcss.com/ lets you make a working example at least
Tailwind Play
Tailwind Play
An advanced online playground for Tailwind CSS that lets you use all of Tailwind's build-time features directly in the browser.
https://f90d-92-190-178-175.ngrok-free.app/
I changed it to after:fixed so you can see how i'd like it to be
of course that doesnt help at all
So
position: absolute
worked, the problem is the height: 100%
gives it the height of the parent, so it only has a height of 86px, and we don't see anything.
Because it's just decorative, you could give it a big height, like height: 100vh
or something (the bigger the number, the more of the waves you'll see) and it should be fine. The issue is the left and right sides because it's inside something limiting the total size.
I think the easiest is to remove the width: 100%
and use left: -64px
and right: -64px
to pull it into that empty space. Of course, I'm not sure if that size changes at different screen sizes, so it might been some playing around with.🤔
i see that now
Thanks i'll see what i can do but that was very helpful indeed :DD
OK Now it works as i was aiming for finally haha
i moved it outside the parent and it fixed the borders
I marked this as Solved