Design comparison
Solution retrospective
I'm having a hard time putting the dice button on the border of the advice "card", any tips? I was thinking of setting its position to absolute, but this way it wouldn't be able to re-position itself when the card resizes when there is a change in the advice text. Thanks
Community feedback
- @mvrius4Posted over 2 years ago
Hi, @unimibYNGX!
You can put position: absolute; on the img, and then position: relative; on the main div.
You need to delete the containing div of the image for this, add a bit of padding-bottom to the parent div(the main div, the one with padding-bottom: 30px)(I really believe that 2.5rem or 3rem is good, as I've tested already) and add background and padding to the image, border-radius, and it will still be good. You can also add a cursor: pointer; on it.
You give bottom: 0; to the image and transform: translateY(...rem).
If you didn't understand what I've said, you can also see my solution, basically what I've explained is what I've did in my project.
I hope this helped you a bit. :D
Marked as helpful2 - @zubyCharlesPosted over 2 years ago
if the button is contained in its own container div, add this style to the div
width: fit-content; margin: 0 auto; transform: translateY(xrem); } The first 2 lines centers the button horizontally, then you can use the translateY property to position it on the cards border.
1
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