Design comparison
Solution retrospective
Another challenge tackling HTML/CSS/Vanille JS. First time ever using API. This was fun and I learned a lot.
Got some more tailwind practice with this project as well. Some colors are off but thats because I was using default tailwind libraries and not specific CSS colors. I was not worried about those details as much as I was about learning how to use APIs with JS.
Not sure why i'm struggling so much with layering elements using Z-index. I feel like I layer it properly then suddenly the layered element breaks with any sizing. I can't seem to layer things without using absolute. If I use relative it never breaks outside of the box its in. Maybe I should add a parent container? Not sure how to approach this problem with layering stuff like the button in this challenge. Will update, this was my first submission.
Any feedback is welcome
Community feedback
- @elyyysePosted over 1 year ago
Hey, Cesar - I also get a little flummoxed by the position property. I don't know much about Tailwind, but with plain CSS — the thing you want you want to stick in place (the button) needs to be
position: absolute
, and the container you want to stick it to (the advice box) needs to beposition: relative
.And then to get it to hang off the bottom of the box like it does in the design, you want to give the button a bottom of negative half the height of itself. So something like this:
container { position: relative; } button { position: absolute; bottom: -30px; /* assumes the button is 60px tall */ }
That
bottom: -30px;
is saying, "stick to the bottom of the box, but move down 30px." A positive number would move it upward. So long as the button stays the same size, you shouldn't have problems with it moving around. I hope this helps!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